Skip to content

Instantly share code, notes, and snippets.

@joffilyfe
Created January 18, 2015 17:50
Show Gist options
  • Save joffilyfe/5fa642ce4bcfbdbee3e0 to your computer and use it in GitHub Desktop.
Save joffilyfe/5fa642ce4bcfbdbee3e0 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(void) {
int entrada, numero, i, j, sum;
entrada = numero = i = j = sum = 0;
scanf("%d", &entrada);
for (i = 0; i < entrada; i++) {
scanf("%d", &numero);
for (j = 1; j < numero; j++) {
if (numero % j == 0) {
sum += j;
}
}
if (sum == numero) {
printf("%d eh perfeito\n", numero);
} else {
printf("%d nao eh perfeito\n", numero);
}
sum = 0;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment