class sum
{
void main ()
{
int sum = 0;
int n = 1;
while ( n <= 100 )
{
sum = sum + n;
n++ ;
}
System.out.println("Sum is = " + sum );
}}
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.
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"); } }
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).
Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
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.
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.
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"); } }
#!/usr/bin/perl print 'java program';
hi question is here, 1 1 2 1 2 3 1 2 3 4
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).
yes ,i can add the website link in java program when we write.
Exactly what do you mean by 'C program in Java'
for(int i = 1; i < 100; i+=2) { System.out.println(i); }
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);
Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.
write a java program to display "Welcome Java" and list its execution steps.