Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int hour,min,seg,counter = 0;
- printf("Entre com o horario : (formato hh/mm/ss)\n");
- scanf("%d %d %d",&hour,&min,&seg);
- if ((hour>=24)||(hour<0))
- {
- printf("HORA INVALIDA!\n"); counter++;
- }
- if ((min>=60)||(min<0))
- {
- printf("MINUTOS INVALIDOS!\n"); counter++;
- }
- if ((seg>=60)||(seg<0))
- {
- printf("SEGUNDOS INVALIDOS!\n"); counter++;
- }
- if (counter == 0)
- {
- printf("HORA VALIDADA!\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment