Computer Science, asked by dishachaturbedi, 1 month ago

write a program to print the first 50 odd numbers and also print the sum of the numbers in java​

Answers

Answered by Rithanyasri
2

Explanation:

1.Create two variables even Sum and odd Sum and initialize them by 0.

2.Start For loop from 1 to 2*n.

3. If i is even Add i with even Sum.

4. Else add i with odd Sum.

5. Print evenSum and oddSum at the end of loop.

Similar questions