Perfect int number

 /* stdin is input standard input

*/


#include <stdio.h>

#include <stdlib.h>


#define SIZE 30


int main (){

int num, rem, sum=0, counter;

printf("plz enter the number \n");

scanf("%d", & num);

for(counter =1 ; counter <= ( num/2 ) ; counter++){

    rem = num%counter;

    if (rem==0){

        sum = sum+ counter;

    }

}

if (sum == num){

    printf("the number %d is a perfect integer number",num);

} else{

printf("the number %d is a not a perfect integer number", num);

}


return 0 ;

}

Comments

Popular posts from this blog

Factors : using C

Cross shaped pattern

Factorial ! calculation