Untitled
raw download clone
C
views 17
,
size 598 b
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    
    if(a==1&&b>=2){
    printf("%d%d:%d%d",a-1,b-2,c,d);
    printf(" ");
    printf("p.m.");
    }
    else if(a==2&&b>=2){
        printf("%d%d:%d%d",a-1,b-2,c,d);
        printf(" ");
        printf("p.m.");
    }
    else if(a==2&&b<2){
        printf("%d%d:%d%d",a-2,b+8,c,d);
        printf(" ");
        printf("p.m.");
    }
    else{
        printf("%d%d:%d%d",a,b,c,d);
        printf(" ");
        printf("a.m.");
    }
        return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.