In the Perfect Number Program, when I run the program I enter a number such for example 6 which is a perfect number after I put in the number it says its not a perfect number if I entered a different perfect number like 28, 496, 8128 it still says its not a perfect number. Is there something in my code that prevents from showing the perfect numbers after entering the number?

Code:#include<stdio.h> #include<math.h> int main() { int perfect(int c); int a,b,c,i; printf("Enter a Number: " ); scanf("%d",&a);c=0; if(c==a) { printf("\nA perfect number\n"); } else printf("\nNot a perfect Number\n"); return 0; } int perfect(int c) { int a,b,i; for(i=1;i<a;i++) { b=a%i; if(b==0) { c=c+i; if(c==a) { printf("\nA perfect number\n"); } else printf("\nNot a perfect Number\n"); } return 0; } }