nikolas_serafini

Lista 2 - Exercício 36

May 27th, 2013
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int hour,min,seg,counter = 0;
  7.  
  8.     printf("Entre com o horario : (formato hh/mm/ss)\n");
  9.     scanf("%d %d %d",&hour,&min,&seg);
  10.  
  11.     if ((hour>=24)||(hour<0))
  12.     {
  13.     printf("HORA INVALIDA!\n"); counter++;
  14.     }
  15.     if ((min>=60)||(min<0))
  16.     {
  17.     printf("MINUTOS INVALIDOS!\n"); counter++;
  18.     }
  19.     if ((seg>=60)||(seg<0))
  20.     {
  21.     printf("SEGUNDOS INVALIDOS!\n"); counter++;
  22.     }
  23.     if (counter == 0)
  24.     {
  25.     printf("HORA VALIDADA!\n");
  26.     }
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment