fork download
  1. #include <stdio.h>
  2.  
  3. //HH:MMa/p
  4. i;f(char*p){i=atoi(p)%12+(p[5]^97?12:0);*p=i/10+48;p[1]=i%10+48;p[5]=0;}
  5.  
  6. int main(void) {
  7. // your code goes here
  8. char t1[] = "12:00a";
  9. char t2[] = "01:00a";
  10. char t3[] = "11:00a";
  11. char t4[] = "12:00p";
  12. char t5[] = "01:00p";
  13. char t6[] = "11:00p";
  14. f(t1); puts(t1);
  15. f(t2); puts(t2);
  16. f(t3); puts(t3);
  17. f(t4); puts(t4);
  18. f(t5); puts(t5);
  19. f(t6); puts(t6);
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 10320KB
stdin
Standard input is empty
stdout
00:00
01:00
11:00
12:00
13:00
23:00