/* program to check a number is complete square or not */
#include<iostream.h>
#include<conio.h>
void main()
{
int a,sq,c,i;
a=0;
cout<<"\nEnter a number:";
cin>>sq;
c=sq/2;
cout<<"\n------------------------------------------";
for(i=2;i<=c;i++)
{
if(sq==(i*i))
{
cout<<"\nNumber "<<sq<<" is "<<"Square of: "<<i;
a=1;
}
}
if(a==0)
{
cout<<"\nNot complete square";
}
cout<<"\n------------------------------------------";
getch();
}
No comments:
Post a Comment