-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.31.c
28 lines (28 loc) · 766 Bytes
/
2.31.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* 2.31 (Table of Squares and Cubes) Using only the techniques you learned in this chapter, write
a program that calculates the squares and cubes of the numbers from 0 to 10 and uses tabs to print
the following table of values:*/
#include <stdio.h>
int main() {
int a;
a=1;
printf("%-5d%-5d%-5d\n",a,a*a,a*a*a );
a=2;
printf("%-5d%-5d%-5d\n",a,a*a,a*a*a );
a=3;
printf("%-5d%-5d%-5d\n",a,a*a,a*a*a );
a=4;
printf("%-5d%-5d%-5d\n",a,a*a,a*a*a );
a=5;
printf("%-5d%-5d%-5d\n",a,a*a,a*a*a );
a=6;
printf("%-5d%-5d%-5d\n",a,a*a,a*a*a );
a=7;
printf("%-5d%-5d%-5d\n",a,a*a,a*a*a );
a=8;
printf("%-5d%-5d%-5d\n",a,a*a,a*a*a );
a=9;
printf("%-5d%-5d%-5d\n",a,a*a,a*a*a );
a=10;
printf("%-5d%-5d%-5d\n",a,a*a,a*a*a );
return 0;
}