Write a C program to check Perfect Number || C Programming Tutorials

Опубликовано: 09 Октябрь 2024
на канале: Learning and Teaching Coding
237
10

@learningandteachingcoding07

====== What is Perfect Number =========
In mathematics, a perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself.

28
= 1,2,4,7,14 (all possible divisible numbers)
= 1+2+4+7+14 (add one by one)
= 28 (final result match to original number)

For example, 28 is a positive number that is completely divisible by 1, 2, 4, 7 and 14. We know that the number is also divisible by itself but we will include it in the addition of divisors.

Then we add these divisors (1 + 2 + 4 + 7 + 14 = 28), it produces 28, which is equal to the number that we have considered.

So, it means that 28 is a perfect number.

#LearningandTeachingCoding
#CProgrammingTutorials
#CPrograms