C Program to find the perfect numbers below a given number.

by Nideesh C on April 18, 2011 · 0 comments

in C Programming




#include<stdio.h>
#include<math.h>
void main()
{
int i,n,sum,lim;
clrscr();
printf(“nnt ENTER THE UPPER LIMIT…: “);
scanf(“%d”,&lim);
printf(“nnt THE PERFECT NUMBER ARE..:”);
for(n=1;n<lim;n++)
{
sum = 0;
for(i=1;i<n;i++)
if(n%i == 0)
sum = sum + i;
if (sum == n)
printf(“nnttt%d”,n);
}
getch();
}

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C Program to find the perfect numbers between a given range
  2. C Program to find the prime numbers below a given number.
  3. C program to find the number of integers divisible by 5 between the given range N1 and N2, where N1 < N2 and are integers. Also find the sum of all these integer numbers that divisible by 5 and output the computed results
  4. C Program – Find the sum of secondary diagonal of a Matrix
  5. C Program – Find the sum of primary diagonal of a Matrix

Leave a Comment

Previous post:

Next post: