answersLogoWhite

0

class sum

{

void main ()

{

int sum = 0;

int n = 1;

while ( n <= 100 )

{

sum = sum + n;

n++ ;

}

System.out.println("Sum is = " + sum );

}}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Write a java script program to print first ten odd natural numbers in C?

Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.


How do you write a program in java to read ten numbers and print sum of ten integers?

Add the numbers into one variable as you read them in. But if you prefer, you can read the numbers into an array and then use a loop to add the numbers together.


Write in BlueJ to print lucky numbers?

To print lucky numbers in java, you must give the following program: class example { static public void main(String[] args) { System.out.println("Lucky number is your favourite number which is your DOB"); } }


What is java program on computers?

#!/usr/bin/perl print 'java program';


Write a program to Print pyramid of numbers using java?

hi question is here, 1 1 2 1 2 3 1 2 3 4


Write a java program to print the result in the series?

If you have the series stored in an array, you loop through the array and print each array element in turn. Another possibility is to print out the numbers in the series as you generate them. In that case, you may not need to store anything (depending on the series, of course).


Can we add website link when we write java program?

yes ,i can add the website link in java program when we write.


Write a c program Fibonacci series using for loop in java?

Exactly what do you mean by 'C program in Java'


Write a java program to find sum of even and odd numbers in given array?

for(int i = 1; i &lt; 100; i+=2) { System.out.println(i); }


How do you write a program in java that prints 2 to the power of 999?

Fortunately for us, Java can handle arbitrarily-large numbers via the BigInteger class. This will compute and print out the value of 2999 final BigInteger TWO = BigInteger.valueOf(2L); final int exponent = 999; final BigInteger answer = TWO.pow(exponent); System.out.println(answer);


Write a java program to print the last digit in Fibonacci series?

Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.


What is javadoc?

write a java program to display "Welcome Java" and list its execution steps.