Program 12.22 Write a program to print the sum of odd numbers between 1 and 100.
Answers
Answered by
0
Answer:
class SumOfNum
{
public static void main(String args[])
{
int sum = 0;
for (int i = 1; i <= 100; i++)
{
if (i % 2 != 0)
{
sum = sum + i;
}
}
System.out.println("The Sum Of 100 Odd Numbers are:" + sum);
}
}
Explanation:
tell me if you want to do it in any other language this one is done in java
Similar questions