DC [29/05/2021]

 

IMPORTANT: Do not write the main() function as it is already defined.


Example Input/Output 1:

Input:

09:15

17:30

60


Output:

10:15

11:15

12:15

13:15

14:15

15:15

16:15

17:15


Explanation:

Here X=60, so the alarm sounds every 60 minutes from 09:15 to 17:30.

10:15

11:15

12:15

13:15

14:15

15:15

16:15

17:15


Example Input/Output 2:

Input:

04:00

12:15

45


Output:

04:45

05:30

06:15

07:00

07:45

08:30

09:15

10:00

10:45

11:30

12:15

**************************************************

CODING SNIPPET:


void printAlarmTimings(char startTime[],char endTime[],int x)


{

    int startMM=atoi(&startTime[3]),endMM=atoi(&endTime[3]);

    startTime[2]='\0';

    endTime[2]='\0';

    int startHH=atoi(startTime),endHH=atoi(endTime);

    int startTimeInMins=(startHH*60)+startMM;

    int endTimeInMins=(endHH*60)+endMM;

    //

    startTimeInMins+=x;

    while(startTimeInMins<=endTimeInMins)

    {

        printfInTimeFormat(startTimeInMins);

        startTimeInMins+=x;

    }

}


void printfInTimeFormat(int Time)

{

    int HH=Time/60;

    Time=Time-(HH*60);

    int MM=Time;

    printf("%02d:%02d\n",HH,MM);

    return 0;

}


**************************************************

Comments

Popular posts from this blog

alphabet matrix minimum sum path

C--Starter-part007---skillrack