fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. //Declaración de variables
  5. int numero=1;
  6. int numero=2;
  7. int numero=3;
  8. char opcion='';
  9.  
  10. printf("Escribe el primer numero:\n");
  11. scanf("%i";numero=1);
  12. printf("Escribe el segundo numero:\n");
  13. scanf("%i";numero=2);
  14. printf("Escribe el tercer numero:\n");
  15. scanf("%i";numero=3);
  16.  
  17. //Leemos la opcion
  18. printf("introduce tu opcion (a:máximo, b:mínimo)");
  19. scanf("%c";&numero1);
  20. printf("introduce tu opcion (a:máximo, b:mínimo)");
  21. scanf("%c";&numero2);
  22. printf("introduce tu opcion (a:máximo, b:mínimo)");
  23. scanf("%c";&numero3);
  24.  
  25.  
  26. if (opcion=='a')
  27. {
  28. //Ha introducido una a calculamos el máximo
  29. if (numero1>numero2)
  30. if(numero1>numero3)
  31. printf("\nE1 mayor es el número 1");
  32. else
  33. printf("\nE1 mayor es el número 3");
  34. else
  35. if (numero2>numero3)
  36. printf("\nE1 mayor es el número2");
  37. else
  38. printf("\nE1 campeon es el número3");
  39. }
  40. else
  41. {
  42. return 0;
  43. }
  44.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1 2 3
compilation info
prog.c: In function ‘main’:
prog.c:6:6: error: redefinition of ‘numero’
  int numero=2;
      ^~~~~~
prog.c:5:6: note: previous definition of ‘numero’ was here
  int numero=1;
      ^~~~~~
prog.c:7:6: error: redefinition of ‘numero’
  int numero=3;
      ^~~~~~
prog.c:6:6: note: previous definition of ‘numero’ was here
  int numero=2;
      ^~~~~~
prog.c:8:14: error: empty character constant
  char opcion='';
              ^~
prog.c:11:12: error: expected ‘)’ before ‘;’ token
  scanf("%i";numero=1);
            ^
            )
prog.c:11:10: warning: format ‘%i’ expects a matching ‘int *’ argument [-Wformat=]
  scanf("%i";numero=1);
         ~^
prog.c:13:12: error: expected ‘)’ before ‘;’ token
  scanf("%i";numero=2);
            ^
            )
prog.c:13:10: warning: format ‘%i’ expects a matching ‘int *’ argument [-Wformat=]
  scanf("%i";numero=2);
         ~^
prog.c:15:12: error: expected ‘)’ before ‘;’ token
  scanf("%i";numero=3);
            ^
            )
prog.c:15:10: warning: format ‘%i’ expects a matching ‘int *’ argument [-Wformat=]
  scanf("%i";numero=3);
         ~^
prog.c:19:12: error: expected ‘)’ before ‘;’ token
  scanf("%c";&numero1);
            ^
            )
prog.c:19:10: warning: format ‘%c’ expects a matching ‘char *’ argument [-Wformat=]
  scanf("%c";&numero1);
         ~^
prog.c:21:12: error: expected ‘)’ before ‘;’ token
  scanf("%c";&numero2);
            ^
            )
prog.c:21:10: warning: format ‘%c’ expects a matching ‘char *’ argument [-Wformat=]
  scanf("%c";&numero2);
         ~^
prog.c:23:12: error: expected ‘)’ before ‘;’ token
  scanf("%c";&numero3);
            ^
            )
prog.c:23:10: warning: format ‘%c’ expects a matching ‘char *’ argument [-Wformat=]
  scanf("%c";&numero3);
         ~^
prog.c:29:7: error: ‘numero1’ undeclared (first use in this function); did you mean ‘numero’?
   if (numero1>numero2)
       ^~~~~~~
       numero
prog.c:29:7: note: each undeclared identifier is reported only once for each function it appears in
prog.c:29:15: error: ‘numero2’ undeclared (first use in this function); did you mean ‘numero’?
   if (numero1>numero2)
               ^~~~~~~
               numero
prog.c:30:14: error: ‘numero3’ undeclared (first use in this function); did you mean ‘numero’?
   if(numero1>numero3)
              ^~~~~~~
              numero
prog.c:43:1: error: expected declaration or statement at end of input
 }
 ^
prog.c:7:6: warning: unused variable ‘numero’ [-Wunused-variable]
  int numero=3;
      ^~~~~~
prog.c:11:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i";numero=1);
  ^~~~~~~~~~~~~~~~~~~~
prog.c:13:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i";numero=2);
  ^~~~~~~~~~~~~~~~~~~~
prog.c:15:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i";numero=3);
  ^~~~~~~~~~~~~~~~~~~~
prog.c:19:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%c";&numero1);
  ^~~~~~~~~~~~~~~~~~~~
prog.c:21:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%c";&numero2);
  ^~~~~~~~~~~~~~~~~~~~
prog.c:23:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%c";&numero3);
  ^~~~~~~~~~~~~~~~~~~~
stdout
Standard output is empty