➽ Problem:-

https://www.hackerrank.com/challenges/time-conversion/problem

➽ Solution:-

#include<stdio.h>

#include<string.h>

int main()

{

    int hour, minute, second;

    char c[3];

    scanf("%d:%d:%d%s", &hour, &minute, &second, &c);

   

    if(strcmp(c,"PM")==0 && hour!=12)

        hour += 12 ;

    else if(strcmp(c,"AM")==0 && hour==12)

        hour = (hour+12) % 24;

       

    printf("%02d:%02d:%02d", hour, minute, second) ;

    return 0;

}