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

int main()
{
    int a;
    int t1,t2;
    char c;
    scanf("%d",&a);
    t1 = a/100;
    t2 = a-(t1*100);
    if(0<=t1 <12)
        c = 'a';
    if(t1>=12)
    {
        c = 'p';
        t1 = t1-12;
    }
    //printf("%d %d\n",t1,t2);
    if((10<=t1)&&(t2>=10))
        printf("%d:%d %c.m.",t1,t2,c);
    else if((10<=t1)&&(0<=t2<10))
        printf("%d:0%d %c.m.",t1,t2,c);
    else if((0<=t1<10)&&(t2>=10))
        printf("0%d:%d %c.m.",t1,t2,c);
    else if((0<=t1<10)&&(0<=t2<10))
        printf("0%d:0%d %c.m.",t1,t2,c);
    return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.