Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int num,div,resto,soma=0;
- printf("Digite um numero para saber se ele e perfeito: ");
- scanf("%d",&num);
- for (div=1;div<num;div++)
- {
- resto=num%div;
- if (resto==0)
- {
- soma=soma+div;
- }
- }
- if (soma==num)
- {
- printf("O numero e perfeito!!!");
- }
- else
- {
- printf("O numero nao e perfeito!!!");
- }
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment