Perfect Number

#include<stdio.h>

int main() {
	int no, i = 1, sum = 0;
	printf("Check the given number is Perfect Number or not\n");
	printf("Enter a number:\n");
	scanf("%d", &no);

	/* Loop the process using "while loop" */
	while(i < no) {
		if(no % i == 0)
			sum += i;
		i++;
	}
	if(sum == no)
		printf("It's a Perfect Number!\n");
	else
	printf("It's not a Perfect Number!\n");
	return 0;
}


/* Output */
Check the given number is Perfect Number or not
Enter a number:
6

It's a Perfect Number!

/* ---------------------------------------- */

Check the given number is Perfect Number or not
Enter a number:
8

It's not a Perfect Number!