Created
August 24, 2021 00:54
-
-
Save esthicodes/aa367111ab7e33c4bf24286dc30ff93c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include<string.h> | |
#include<stdio.h> | |
int main() { | |
int hh, mm, ss; | |
char t12[3]; | |
scanf("%d:%d:%d%s", &hh, &mm, &ss, t12); | |
if(strcmp(t12, "PM")==0 && hh != 12) hh +=12; | |
if (strcmp(t12, "AM")==0 && hh==12) hh = 0; | |
printf("%02d:%02d:%02d", hh, mm, ss); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment