Wap to define a function perfect which accepts an integer argument and print whether that number is perfect or not
Answers
Answered by
0
#include<stdio.h>
int main()
{
int n,i,sum=0;
printf("Input a no\n");
scanf("%d",&n);
for(i=1;i<n;i++)
{
if(n%i==0)
sum=sum+i;
}
if(n==sum)
printf("Perfect");
else
printf("Non-Perfect");
return 0;
}
Hope it is helpful
Sahil
Similar questions