P021.c (530B)
1 /* WAP to input a positive number and check if it is a perfect 2 square number or not. */ 3 // This code has not been compiled. 4 // If you find any issues, please create a new issue on GitHub regarding them. 5 6 #include <stdio.h> 7 #include <math.h> 8 int main() 9 { 10 int n, temp; 11 double sr; 12 printf("Enter the number : "); 13 scanf("%d", &n); 14 sr = sqrt(n); 15 temp = (int)sr; 16 if (temp * temp == n) 17 printf("\nThis is a perfect square."); 18 else 19 printf("\nThis is not a perfect square."); 20 return 0; 21 }