Saturday, 14 January 2012

Write a Program to check an integer for perfect square


#include
#include
#include
void main()
{
int num,root;
clrscr();
printf("enter the number=");
scanf("%d",&num);
root=sqrt(num);
if(num==root*root)
{
printf("Perfect Square");
}
else
{
printf("not a perfect Square");
}
getch();
}
 

No comments:

Post a Comment