Advertisement
Mahfuj2406

lab9

Aug 21st, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1.  
  2. #include<stdio.h>
  3. #include<string.h>
  4. int main()
  5. {
  6. int h,m,s;
  7. char str[2];
  8.  
  9. scanf("%d%d%d",&h,&m,&s);
  10. gets(str);
  11.  
  12. if(str[1]=='P'){
  13. h+=12;
  14. printf("%d:%d:%d\n",h,m,s);
  15. }
  16. else
  17. {
  18. if(h==12){
  19. h=0;
  20. }
  21. if(h<10)
  22. printf("0%d:0%d:%d\n",h,m,s);
  23. }
  24.  
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement