Table of reciprocals, squares, cubes, and fourth powers
#include <stdio.h>
int main()
{
double num[11][5];
double value = 0.0;
int y = 0;
int x = 0;
for(y = 0, value = 3.0 ; y<11 ; y++, value += 0.3)
num[y][0] = value;
for(y = 0 ; y<11 ; y++)
{
num[y][1] = 1.0/num[y][0];
num[y][2] = num[y][0]*num[y][0];
num[y][3] = num[y][0]*num[y][0]*num[y][0];
num[y][4] = num[y][0]*num[y][0]*num[y][0]*num[y][0];
}
printf("\n x");
printf(" 1/x");
printf(" x*x");
printf(" x*x*x");
printf(" x*x*x*x");
for(y = 0 ; y<11 ; y++)
{
printf("\n");
for(x = 0 ; x<5 ; x++)
printf("%15.4lf", num[y][x]);
}
}
Related examples in the same category