Thursday, 4 June 2015

How to find square of a number using math.h header file in c++

#include<conio.h>
#include<iostream.h>
#include<math.h>

void main()
{
 clrscr();
 int sq,sum;
 cout<<"Enter the value for Squaring\n";
 cin>>sq;

 sum=pow(sq,2);

 cout<<"Square of the number is "<<sum;

 getch();

}
Coding Format

Output Format

No comments:

Post a Comment