C programming
#include <math.h>
int main()
{
int i,n;
printf("Enter a Number : ");
scanf("%d",&n);
printf("No Square Cube Square Root\n",n);
for(i=1;i<=n;i++)
{
printf("%d \t %ld \t %ld \t %.2f\n",i,(i*i),(i*i*i),sqrt((double)i));
}
return 0;
}
Try it Yourself ➠
Square,Cube,Squareroot of numbers from 1 to n
26 July
0
Write a program (WAP) in C to calculate Square,Cube,Squareroot of numbers from "1 to n".
#include <stdio.h>#include <math.h>
int main()
{
int i,n;
printf("Enter a Number : ");
scanf("%d",&n);
printf("No Square Cube Square Root\n",n);
for(i=1;i<=n;i++)
{
printf("%d \t %ld \t %ld \t %.2f\n",i,(i*i),(i*i*i),sqrt((double)i));
}
return 0;
}
Must Read :-
Previous article
Next article
Leave Comments
Post a Comment