fork download
  1. int main() {
  2. int i, n, sum=0, mul=0;
  3.  
  4. printf("Ingresa n:\n");
  5. scanf("%d", &n);
  6.  
  7. for(i=1; i<n; i++) {
  8. mul=n%i;
  9. if(mul==0) {
  10. sum+=i;
  11. }
  12. }
  13. if(sum==num){
  14. printf("El numero %d SI es perfecto.\n", n);
  15. }
  16. else
  17. printf("El numero %d NO es perfecto.\n", n);
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
6
compilation info
prog.c: In function 'main':
prog.c:4:2: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
  printf("Ingresa n:\n");
  ^
prog.c:4:2: warning: incompatible implicit declaration of built-in function 'printf'
prog.c:4:2: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:5:2: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
prog.c:5:2: warning: incompatible implicit declaration of built-in function 'scanf'
prog.c:5:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
prog.c:13:10: error: 'num' undeclared (first use in this function)
  if(sum==num){
          ^
prog.c:13:10: note: each undeclared identifier is reported only once for each function it appears in
stdout
Standard output is empty