Program tha calculates the square and cube of the numbers from 1 to 10.
/ * Program tha calculates the square and cube of the numbers from 1 to 10.
This is my code so far, it is instructed to only use the if statement (no else, while, for, etc).
And use the \t to print the bellow table, any hints???? thanks!! */
Code:
number square cube
0 0 0
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
6 36 216
7 49 343
8 64 512
9 81 729
10 100 1000
I've achieved so far the following code:
#include <stdio.h>
#include <conio.h>
main()
{
int num, squ, cub;
num = 0;
squ = num * num;
cub = num * num * num;
printf("\nnumber\tsquare\tcube\n\n");
printf("%d\t%d\t%d\n\n", num, squ, cub);
getch();
return 0;
}
Any suggestions will be appreciated!!!!!!