Computer Science, asked by ricky141087, 1 year ago

write a program to print sum of odd number between 1 and 10

Answers

Answered by KunalHarsh
2
class demo
{
public static void main(String arg[])
{
int i,s=0;
for(i=1;i<=10;i++)
{
if(i%2!=0)
s=s+i;
}
System.out.println(s+"is the sum");
}
}

Similar questions