Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. int hi,hf,ht,mi,mf,mt;
  4. void tempo(int hi, int hf, int mi, int mf);
  5. int main()
  6. {
  7.  
  8. scanf("%d%d%d%d",&hi,&mi,&hf,&mf);
  9. tempo(hi,hf,mi,mf);
  10.  
  11.  
  12. return 0;
  13.  
  14. }
  15. void tempo(int hi, int hf, int mi, int mf)
  16. {
  17.  
  18.  
  19. if(hi > hf)
  20. ht= (24-hi)+hf;
  21.  
  22. if(hi < hf)
  23. ht= hf-hi;
  24. mt=(60-mi)+mf;
  25. if(mf+mi >=60)
  26. {
  27. ht--;
  28.  
  29. }
  30. if(mt==60)
  31. {
  32. ht++;
  33. mt=0;
  34. }
  35. if((hi == hf)&&(mi==mf))
  36. printf("O JOGO DUROU 24 HORA(S)");
  37. else
  38. printf("O jogo durou %d HORA(S) E %d MINUTO(S)",ht,mt);
  39. system("pause");
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement