in codeblocks
------------------------------------------------------------------------------------------
//program to add two times given in hrs,mm and ss using struct
#include <stdio.h>
#include <stdlib.h>
struct timeaddition
{
int hrs;
int mm;
int ss;
}time1,time2,ttime;
int main()
{
int totalmm;
printf("enter first time in hrs,minutes and seconds\n");
scanf("%d%d%d",&time1.hrs,&time1.mm,&time1.ss);
printf("enter second time in hrs,minutes and seconds\n");
scanf("%d%d%d",&time2.hrs,&time2.mm,&time2.ss);
totalmm=time1.mm+time2.mm+(time1.ss+time2.ss)/60;
ttime.ss=(time1.ss+time2.ss)%60;
ttime.mm=totalmm%60;
ttime.hrs=time1.hrs+time2.hrs+totalmm/60;
printf("total hrs=%d minutes=%d and seconds=%d\n",ttime.hrs,ttime.mm,ttime.ss);
return 0;
}
------------------------------------------------------------------------------------------
//program to add two times given in hrs,mm and ss using struct
#include <stdio.h>
#include <stdlib.h>
struct timeaddition
{
int hrs;
int mm;
int ss;
}time1,time2,ttime;
int main()
{
int totalmm;
printf("enter first time in hrs,minutes and seconds\n");
scanf("%d%d%d",&time1.hrs,&time1.mm,&time1.ss);
printf("enter second time in hrs,minutes and seconds\n");
scanf("%d%d%d",&time2.hrs,&time2.mm,&time2.ss);
totalmm=time1.mm+time2.mm+(time1.ss+time2.ss)/60;
ttime.ss=(time1.ss+time2.ss)%60;
ttime.mm=totalmm%60;
ttime.hrs=time1.hrs+time2.hrs+totalmm/60;
printf("total hrs=%d minutes=%d and seconds=%d\n",ttime.hrs,ttime.mm,ttime.ss);
return 0;
}