Computer Science, asked by Anonymous, 1 year ago

what is a perfect number ???

Answers

Answered by Anonymous
4
a perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself (also known as its aliquot sum)
plzz mark it as brainliest
Answered by siddhartharao77
2

Perfect number:

A positive number is called as Perfect number when sum of its divisors is equal to that number.


Example of perfect number:

#include<stdio.h>

void main()

{

int a,b;

printf("Enter any number:");

scanf("%d",&a);

b = 0;

if(a < 0)

{

printf("Negative numbers are not allowed");

}

else

{

for(int i = 1; i<a;i++)

{

if(a%i == 0)

b+=i;

}

}

if(b == a)

printf("%d is Perfect number: ", a);

else

printf("%d is Not perfect number: ", b);

return 0;

}


Output:

Enter any number : 28.

28 is a perfect number.    ---- {1 + 2 + 4 + 7 + 14}


Enter any number : 10.

10 is not a perfect number.   ---- {1,2,5}



Hope it helps!


siddhartharao77: welcome!
Similar questions