Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int srth,endh,srtm,endm,hour,mnt;
- scanf("%d %d %d %d",&srth,&srtm,&endh,&endm);
- if(endm<srtm)
- {
- endm=(60+endm);
- endh=endh-1;
- mnt=endm-srtm;
- if(srth>endh)
- {
- hour=((endh+24)-srth);
- }
- else
- {
- hour=(endh-srth);
- }
- printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n",hour,mnt);
- }
- else if(endm>srtm)
- {
- mnt=endm-srtm;
- if(srth>endh)
- {
- hour=(endh+24)-srth;
- }
- else
- {
- hour=endh-srth;
- }
- printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n",hour,mnt);
- }
- else if(srtm==endm && srth==endh)
- {
- printf("O JOGO DUROU 24 HORA(S) E 0 MINUTO(S)\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement