C Program to Find Perfect Number using while loop

preview_player
Показать описание

Lets write a C program to check if user entered number is a perfect number or not, using while loop.

Perfect Number: A number is called perfect number if sum of its divisors(except the number itself) is equal to the number.

For Example: If the user entered number is 6. The numbers which perfectly divide 6 are 1, 2, 3 and 6. Leave 6 and add all other numbers. i.e., 1 + 2 + 3 = 6. So the entered number and the sum are equal. So 6 is a perfect number.

C Programming Interview / Viva Q&A List

C Programming: Beginner To Advance To Expert
Рекомендации по теме