write a program to print sum of odd number between 1 and 10
Answers
Answered by
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");
}
}
{
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
English,
8 months ago
English,
8 months ago
Sociology,
1 year ago
Math,
1 year ago
India Languages,
1 year ago