bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_1 / tuition-c / APC-PRAC-011.c

APC-PRAC-011.c (629B)


      1 /* Write a program to input positive number and check whether the number is
      2 perfect square or not. If the number is negetive then display appropriate message */
      3 
      4 #include <stdio.h>
      5 #include <math.h>
      6 
      7 int main()
      8 {
      9     int num, temp;
     10     printf("Enter the number : ");
     11     scanf("%d", &num);
     12     if (num < 0)
     13     {
     14         printf("\nYou entered a negetive number.");
     15         return 1;
     16     }
     17     temp = (int)sqrt(num);
     18     if (temp * temp == num)
     19     {
     20         printf("\nInput %d is a perfect square number.", num);
     21         return 0;
     22     }
     23     else
     24         printf("\nInput %d is not a perfect square number.", num);
     25     return 0;
     26 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror