APC-PRAC-017.c (864B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* Write a program to check perfect number. */ 8 // File Name - amit0611202503.c (LAB), APC-PRAC-017.c (Local) 9 10 // This code has not been compiled. 11 // If you find any issues, please create a new issue on GitHub regarding them. 12 // Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues 13 14 #include <stdio.h> 15 16 int main() 17 { 18 int num, i, divisibleSum = 0; 19 printf("Enter a number : "); 20 scanf("%d", &num); 21 for (i = 1; i <= num / 2; i++) 22 { 23 if (num % i == 0) 24 { 25 divisibleSum += i; 26 } 27 } 28 if (divisibleSum == num) 29 printf("\nInput %d ia a Perfect Number.", num); 30 else 31 printf("\nInput %d is NOT a Perfect Number.", num); 32 return 0; 33 }