From a049deb810d1e54d304a279689936f4273f236c9 Mon Sep 17 00:00:00 2001 From: pranu2502 <52481227+pranu2502@users.noreply.github.com> Date: Fri, 2 Oct 2020 12:55:43 +0530 Subject: [PATCH] Update Time conversion Added comments --- Hackerrank/problem solving/Time conversion | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Hackerrank/problem solving/Time conversion b/Hackerrank/problem solving/Time conversion index a84b7a1..96d33f4 100644 --- a/Hackerrank/problem solving/Time conversion +++ b/Hackerrank/problem solving/Time conversion @@ -9,14 +9,14 @@ int main(){ int ss; char t[3]; scanf("%d:%d:%d%s" , &hh, &mm , &ss , &t); - if(hh==12){ + if(hh==12){ //Converting the hours from 12 hr format to 24hr format hh=0; } if(t[0]=='P'){ - hh+=12; + hh+=12; Adding 12 if it is PM } - printf("%02d:%02d:%02d" , hh , mm , ss); + printf("%02d:%02d:%02d" , hh , mm , ss); //Prinitng the answer