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