answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

void main()

{

int i,j,sum;

clrscr();

for(i=1;i<=500;i++)

{

j=1;

sum=0;

while(j<i)

{

if(i%j==0)

sum=sum+j;

j++;

}

if(sum==i)

printf("%d\n",i);

}

getch();

}

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Write a Shell program to find the smallest number from a set of numbers?

k


Write a Shell program to find the sum of cube of individual digits of a number?

no thanks


How do you write a java program to find the square root of a number?

You can use the Math.sqrt() method.


How do you write a C program to find out perfect numbers from 1 and 50?

To find perfect numbers between 1 and 50 in a C program, you can iterate through each number in that range and check if it is equal to the sum of its proper divisors. A perfect number is defined as a number that is equal to the sum of its positive divisors, excluding itself. Here's a basic outline of the program: #include &lt;stdio.h&gt; int main() { for (int num = 1; num &lt;= 50; num++) { int sum = 0; for (int i = 1; i &lt;= num / 2; i++) { if (num % i == 0) sum += i; } if (sum == num) printf(&quot;%d is a perfect number\n&quot;, num); } return 0; } This code checks each number from 1 to 50 and prints out the perfect numbers found in that range.


Make a C programming that displays the first four perfect numbers?

create a program that iterates until it finds a perfect number, then store that perfect number into an array. Continue iterating until you find three more. Then, you have an array of four perfect numbers.


Write a c program to find given number is prime or not?

Yes, do write, or if you're too lazy to your homework, use google.


What is the largest prime no that is stored in 8 bit pattern?

Write your own prime number program and find out.


Write an algorithm for perfect number or not?

1. Get any no. 2. Find it factors. 3. Add its factor. 4. If sum of its factors is equal to itself then it is a perfect no. otherwise not


Writes a c program to find the sum of all integers between 1 and n?

Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11


How do you write Square program using vb?

write a vb program to find the magic square


How do you write socket program in c?

For first find an example program.


Write a program to find the grade obtained by the students of a class using structure?

Write a program to find the grade obtained by the students of a class