Search Your C Program

Thursday, 26 January 2012

Program to Calculate Square Root and Cube of a Number

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
                 int a,cb;
                 float sq;
                 printf("\n Enter a number ");
                 scanf("%d",&a);
                 sq=sqrt(a);
                 cb=pow(a,3);
                 printf(" Sqare root = %f = ",sq);
                 printf("Cube = %d",cb);
}


DESCRIPTION := In this program the in-built functions " sqrt()"  and  "pow() " are used  to calculate sqare root and cude of number.These functions are included in " math.h " header file.  

No comments:

Post a Comment