
Number square cube 1 1 1 3 9 27 5 25 125 7 49 343 9 81 729
total 165 1225
â?? this is the ouput..;;; i need program

class SquareAndCube
{
public static void main(String[] args)
{
int totalSq=0,totalCb=0;
for(int i=1;i<10;i+=2){
int sq=i*i;
int cb=i*i*i;
System.out.println(i+" \t"+sq+" \t"+cb);
totalSq+=sq;
totalCb+=cb;
}
System.out.println("Total: "+totalSq+" "+totalCb);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.