#include <stdio.h>

int main() {
    int a,b,c,d,x,y,z;
    scanf("%d %d %d",&a,&b,&c);
    scanf("%d",&d);
    while(d<60)
    {
        x=d/60;
        z=d%60;
    }
    if(x>60)
    {
        y=x/60;
        x=x%60;
    }
    a=a+y;
    b=b+x;
    c=c+z;
    if(c>=60)
    {
        c-60;
        b+1;
    }
    if(b>=60)
    {
        b-60;
        a+1;
    }
    if(a>=24)
    {
        a-24;
    }
    printf("%d %d %d",a,b,c);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: