We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 51b8b19 commit 20e9f36Copy full SHA for 20e9f36
Hackerrank/Time Conversion.cpp
@@ -0,0 +1,11 @@
1
+#include <bits/stdc++.h>
2
+
3
+using namespace std;
4
+int main() {
5
+ int hh,mm,ss;char ch[3];
6
+ scanf("%d:%d:%d%s",&hh,&mm,&ss,ch);
7
+ if(ch[0]=='A' && hh==12)hh=0;
8
+ if(ch[0]=='P' && hh!=12)hh+=12;
9
+ printf("%02d:%02d:%02d",hh,mm,ss);
10
+ return 0;
11
+}
0 commit comments