/* -------------------------------------------------------
   File   : addtimes.c
   Purpose: Add two times given in hours and minutes
   Author : Lew Baxter
   Date   : 2008-01-17
   ------------------------------------------------------- */

#include <stdio.h>

main()
{
   int hour1, minute1, hour2, minute2, hour, minute;

   /*  output title  */

   printf("=== ADD TWO TIMES ===\n");

   /*  ask user for two times  */

   printf("Enter first  time [hours minutes]: ");
   scanf("%d%d", &hour1, &minute1);
   printf("Enter second time [hours minutes]: ");
   scanf("%d%d", &hour2, &minute2);

   /*  add the two times  */

   hour = hour1 + hour2 + (minute1 + minute2)/60;
   minute = (minute1 + minute2) % 60;

   /* output resulting sum  */

   printf("Sum of the two times             : %d %d \n", hour, minute);
}