solve this question and show answer step by step Write a pro
Solution
#include<stdio.h>
main()
{
double arr[50];
int i;
for(i=0;i<50;i++)
{
if(i<25)
arr[i]=i*i;//to calculate and store square of its index
else
arr[i]=i*i*i;//to calculate and store cube of its index
}
for(i=0;i<50;i++)
{
printf(\"%f \",arr[i]);
if(i%10==0&&i!=0) // to print a new line each after 10 values printed in a line
printf(\"\ \");
}
}
solution:
0.000000 1.000000 4.000000 9.000000 16.000000 25.000000 36.000000 49.000000 64.000000 81.000000 100.000000
121.000000 144.000000 169.000000 196.000000 225.000000 256.000000 289.000000 324.000000 361.000000 400.000000
441.000000 484.000000 529.000000 576.000000 15625.000000 17576.000000 19683.000000 21952.000000 24389.000000 27000.000000
29791.000000 32768.000000 35937.000000 39304.000000 42875.000000 46656.000000 50653.000000 54872.000000 59319.000000 64000.000000
68921.000000 74088.000000 79507.000000 85184.000000 91125.000000 97336.000000 103823.000000 110592.000000 117649.000000
