Computer Science, asked by nischaya2, 1 year ago

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

Answers

Answered by Anonymous
24

//a java program to print sum of cubes of odd nos between 1 and 10

class Oddsum

{

public static void main(String args[ ])

{

int sum=0;

for(int i=1;i<10;i++)

{

if(i℅2==1)

sum=sum+i*i*i;

}

System.out.println("sum="+sum);

}

}

Similar questions