mhdew

Broken Clock

Jan 24th, 2018
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. int f;
  6. int h, m;
  7.  
  8. scanf("%d", &f);
  9. scanf("%d:%d", &h,&m);
  10.  
  11. if(m>59)
  12. m=m%10;
  13.  
  14. if(f==12){
  15. if(h==0)
  16. h=1;
  17. if(h>12)
  18. h=h%10;
  19. }
  20. else if(f==24){
  21. if(h>24)
  22. h=h%10;
  23. }
  24.  
  25. printf("%02d:%02d\n", h,m);
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment