Program to Check Whether Given Number is Perfect Or Not ?
#include<stdio.h> int main() { int n,i=1,sum=0; printf("\nEnter a number: "); scanf("%d",&n); while(i<n){ if(n%i==0) sum=sum+i; i++; } if(sum==n) printf("\n%d is a Perfect Number",i); else printf("\n%d is Non Perfect Number",i); return 0; }
Incoming search terms:
- c program to check whether a number is perfect or not (20)
- c program to find whether a number is perfect or not (17)
- C Program to find whether the number is perfect or not (2)
- find a number perfect no or not (1)
- input a number &check it perfect number or not in c language (1)
- a C program to CHECK a given number is perfect (1)