Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. main()
  6. {
  7.     int a=0,b=0,i=0;
  8.     float numero;
  9.     char num[3];
  10.    
  11.     printf("Introduzca un numero del -10 al 10: ");
  12.     gets(num);
  13.     numero=atoi(num);
  14.  
  15.     if(num[0]!='-' && numero<=10) {
  16.         printf("El valor introducido es correcto.\n");
  17.     }
  18.     else if(num[0]=='-' && numero=>'-10') {
  19.         printf("El valor introducido es correcto.\n");
  20.     }
  21.     else {
  22.         if(num[0]=='-' && numero>10) {
  23.             printf("Se ha introducido un número menor de lo esperado.\n");
  24.         }
  25.         else if(numero>10) {
  26.             printf("Se ha introducido un número mayor de lo esperado.\n");
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement