Write a program in 'C' to enter any positive number and to calculate and print its square and cube
#include< #include< #include< main() { float n, s, c; printf("Enter any positive number\n"); scanf("%f", &n); s = pow(n , 2); c = pow(n , 3); printf("The Square is %f\n", s); printf("The Cube is %f\n", c); return(0); } |
---|
For eg :-
Output :-
Enter any positive number
2.5
The Square is 6.250000
The Cube is 15.6250000
0 comments:
Post a Comment