programming9
  • Flowcharts
  • Programs
      • Back
      • C Programs
      • C++ Programs
      • Java Programs
      • Python Codes
      • HTML Codes
      • Java Script Codes
      • SQL Codes
  • Tutorials
      • Back
      • Java Tutorials
      • Competitive Programming
      • Python Tutorials
      • C Programming
  • Blog
  • Login

C Program to Find Given Number is Perfect or Not

Details
Written by: RajaSekhar
Category: C Programs
  • basic c programs
  • Perfect number in c
#include<stdio.h>
void main()
{
    int n,i=1,sum=0;
    printf("\n Enter a Number : ");
    scanf("%d",&n);
    while(i<n)
    {
        if(n%i==0)
            sum=sum+i;
        i++;
    }
    if(sum==n)
        printf("%d is a Perfect Number",i);
    else
        printf("%d is Not a Perfect Number",i);

}

 OUTPUT:

 Enter a Number : 6
 
6 is a Perfect Number
Previous article: C Program to Check the Leap Year Prev Next article: C Program to find Size of Integer Next
  • C Program to Check the Leap Year
  • C Program to Find Nth Fibonacci Number Using Recursion
  • C program to find Sum of Digits of a Positive Integer Number
  • Check a Character is Vowel or not Using C
  • C Program to Find Factorial of a Number using While Loop
  • C Program to Design Lexical Analyzer
  • C Program for Optimal Page Replacement Algorithm
  • C Program to Implement CONTINUE statement
  • C Program to Reverse Elements in Array
  • C Program to Sort List of Strings
  • C Program to Print ASCII values of Characters
  • Implementation of Queue using Array in C
  • C Program to Compare Two Strings using strcmp()
  • C Program to Implement Single Linked List Operations
  • Find Two's Complement of a Binary Number Using C programming
  • Privacy Policy
  • Cookie Policy
© programming9.com 2026
Back to top