Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define MAX_VALUE 10000
- int main(int argc, const char * argv[])
- {
- int j = 0,i_nums=0,FactorSum=0;
- char c_nums[MAX_VALUE];
- while(1)
- {
- scanf("%s",c_nums);
- i_nums = atoi(c_nums);
- if(i_nums != 0)
- {
- FactorSum = 0;
- if(i_nums == 1) printf("%d No\n",i_nums);
- else
- {
- for(j = 1; j<i_nums/2+1; j++)
- {
- if(i_nums % j == 0) FactorSum = FactorSum + j;
- else ;
- }
- if(FactorSum == i_nums) printf("%d Yes\n",i_nums);
- else printf("%d No\n",i_nums);
- }
- }
- else return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment