write a java program to find out sum of all odd numbers from 100 to 200
Answers
Answered by
3
Explanation:
please refer to the above pic
Attachments:
Answered by
1
Write a java program to find out sum of all odd numbers from 100 to 200
Explanation:
Java program to print sum of odd numbers from 100 to 200.
class Main
{
public static void main(String args[])
{
int sum = 0;
for (int i = 100; i <= 200; i++)
{
if (i % 2 != 0)
{
sum = sum + i;
}
}
System.out.println("The Sum Of Odd Numbers from 100 to 200 are:" + sum);
}
}
OUTPUT
The Sum Of Odd Numbers from 100 to 200 are:7500
Similar questions