#include<stdio.h>
int main()
 {

     int n,i,c=0;
     printf("\nEnter a no:");
     scanf("%d",&n);
     for(i=1;i<n;i++)
      {
          if(n%i==0)
           {
               c=c+i;
           }

      }

   if(n==c)
     printf("\nPerfect no.");
    else
      printf("\nNot a perfect no.");

 }

Edited 5 Years Ago by Narue: Added code tags

#include<stdio.h>
    #include<conio.h>
    int main()
    {
     
    int n,i,c=0;
    printf("\nEnter a no:");
    scanf("%d",&n);
    for(i=1;i<n;i++)
    {
    if(n%i==0)
    {
    c=c+i;
    }
     
    }
     
    if(n==c)
      {printf("\nPerfect no.");getch();}
    else
      {printf("\nNot a perfect no.");getch();}
     
    }

Edited 5 Years Ago by Narue: added code tags

hey buddy if u r not aware of c programming language then pl dont visit this site...!!!

First learn c nd then dare to post on ma uploads....!!!

Go learn first champ...!!!

compzets:-
We are not here to check full codes if you are not specifying your problems.what do you want..??
positing the same code doesn't make a clear idea to us again about your problem.

SPECIFY YOUR AREA OF PROBLEM

hey buddy if u r not aware of c programming language then pl dont visit this site...!!!

you should check about the detail of person whom you used to say like this. seems to be you are a newbie.

First learn c nd then dare to post on ma uploads....!!!

you don't ve much idea about the basics of C..google the standards of C and first learn them.

Go learn first champ...!!!

yep you are right...go learn first champ...!!

now to your programming part..

#include<conio.h>

not a recognized file or directory in gcc compliers..

please stop using getch() it's not in use for any gcc compilers.
its terrible to use getch() now.

Edited 5 Years Ago by cse.avinash: n/a

This article has been dead for over six months. Start a new discussion instead.