/*gowrikausalya.blogspot.com*/
/*c-program to find whether the given number is perfect square or not*/
#include<stdio.h>#include<conio.h>
#include<math.h>/*sqrt()*/
main()
{
int m, n;
float p;
printf("Enter any integer : \n");
scanf("%d", &n);
p =sqrt(n);
m=p;
if(p == m)
printf("%d is a perfect square",n);
else
printf("%d is not a perfect square",n);
getch();
}
this program will display the output as:-
Enter any integer :
144
144 is a perfect square
Enter any integer :
133
133 is not a perfect square
No comments:
Post a Comment