c program to addition of two times using structure

Programming Example

Define a structure Time having integer data members hour, minute, second. Write a program to enter two variables of the type Time and then add these two variables and store the result into third variable. Also validate the second and minute of the result and print it.


struct Time
	int hour,minute,second;
int main()
	struct Time t1,t2,t3;
	printf("Enter the Time 1 (Hour,minute and Second)");
	printf("Enter the Time 2 (Hour,minute and Second)");
	printf("\n Time 1 %d : %d : %d",t1.hour,t1.minute,t1.second);
	printf("\n Time 2 %d : %d : %d",t2.hour,t2.minute,t2.second);
	printf("\n Time 3 %d : %d : %d",t3.hour,t3.minute,t3.second);
	return 0;

Enter the Time 1 (Hour,minute and Second)3 40 50

Enter the Time 2 (Hour,minute and Second)2 45 50

 Time 1 3 : 40 : 50

 Time 2 2 : 45 : 50

 Time 3 6 : 26 : 40

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad