class sum
{
public static void main(String are[])
{
int i,j,osum=0,esum=0;
for(i=0;i<=10;i++)
{
if((i%2)==0)
{
esum=esum+i;
}
}
for(j=0;j<=10;j++)
{
if((j%2)==1)
{
osum=osum+j;
}
}
System.out.println("Sum of odd number is " + osum);
System.out.println("Sum of even number is " + esum);
}
}
0 Comments