Explore BrainMass
Share

Explore BrainMass

    Time Conversion Program in C

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    1- inputs a time duration in hours, minutes, and seconds;
    2-calculates the equivalent total number of seconds;
    3-recalculates the hours, minutes, and seconds from the total;
    4-displays the values of the hours, minutes, seconds, and total seconds.

    Specific Requirements

    1-The program must be otherwise formatted and documented
    2-The program should contain a single method, main
    3-The program should declare 4 variables, hours, minutes, seconds, and totalSeconds, all of type int. You may declare at most 1 additional variable for temporary usage. No other variable are allowed.
    4- The program should declare and use exactly 2 constants, MIN_PER_HR and SEC_PER_MIN (minutes per hour and seconds per minute)
    5-The input statement(s) must be preceded by a suitable prompt(s).
    6-The output produced by your program should be a single line

    © BrainMass Inc. brainmass.com October 9, 2019, 5:43 pm ad1c9bdddf
    https://brainmass.com/computer-science/c/time-conversion-program-in-c-65486

    Solution Preview

    I have coded the required program along with remarks on different parts of the program.
    Hope it helps you ...

    Solution Summary

    Helps you understand how to write a C program to do the following:
    1- Input a time duration in hours, minutes, and seconds;
    2- Calculate the equivalent total number of seconds;
    3- Re-calculate the hours, minutes, and seconds from the total;
    4- Display the values of the hours, minutes, seconds, and total seconds.

    $2.19