Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Saturday, January 2, 2010

Write a program in 'C' to enter any positive number and to calculate and print its square and cube



#include<stdio.h>
#include<conio.h>
#include<math.h>
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

Related Posts by Categories



0 comments:

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP