total of two times
#include <stdio.h>
int main(void) {
int s1,s2,s3,m1,m2,m3,h1,h2,h3,d1,d2,d3;
printf("hello user ,welcome to the system :\n");
printf("data time 1 :\n");
printf("hours :");
scanf("%d",&h1);
printf("minutes :");
scanf("%d",&m1);
printf("seconds :");
scanf("%d",&s1);
if (h1>=24){
h1-=24;
d1++;
}
if(m1>=60){
m1-=60;
h1++;
}
if(s1>=60){
s1-=60;
m1++;
}
printf("\ndata time 2 :\n");
printf("hours :");
scanf("%d",&h2);
printf("minutes :");
scanf("%d",&m2);
printf("seconds :");
scanf("%d",&s2);
if (h2>=24){
h2-=24;
d2++;
}
if(m2>=60){
m2-=60;
h2++;
}
if(s2>=60){
s2-=60;
m2++;
}
h3=h1+h2;
if(h3>=24){
h3-=24;
d3++;
}
m3=m2+m1;
if(m3>=60){
m3-=60;
h3++;
}
s3=s2+s1;
if (s3>=60){
s3-=60;
m3++;
}
d3=d2+d1;
printf("\nthe new data_time is : %d:%d:%d",h3,m3,s3);
if(d3>0){
printf("\nand %d day",d3);
}
return 0;
}