fork download
  1. #include <stdio.h>
  2. int main() {
  3. int numero;
  4. printf("Introduce un número entero: ");
  5. scanf("%d", &numero);
  6. if (numero < 0) { // Solo se muestra el número si es negativo
  7. printf("El número negativo es: %d", numero);
  8. }
  9. return 0;
  10. }
Success #stdin #stdout 0s 5288KB
stdin
-2
stdout
Introduce un número entero: El número negativo es: -2