Question

Write a function that takes in the number of minutes past 12:00 PM and print the...

Write a function that takes in the number of minutes past 12:00 PM and print the corresponding time. C Language ONLY.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <stdio.h>

void print_time(int seconds_after_12) {
    int hours, minutes, seconds;
    hours = seconds_after_12 / 3600;
    seconds_after_12 %= 3600;
    minutes = seconds_after_12 / 60;
    seconds = seconds_after_12 % 60;
    if (hours == 0)
        hours = 12;
    printf("%02d:%02d:%02d PM\n", hours, minutes, seconds);
}

int main() {
    print_time(10000);
    return 0;
}
Add a comment
Know the answer?
Add Answer to:
Write a function that takes in the number of minutes past 12:00 PM and print the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write the python function time to midnight() that takes the name of a file containing multiple...

    Write the python function time to midnight() that takes the name of a file containing multiple lines of text giving time in HH:MM:SS HRS or HH:MM:SS AM or HH:MM:SS PM format one per line. The HRS notation indicates CSE 101 – Summer 2019 Lab Assignment #9 2 that the time has been given in 24-hour time format. Each line tells the current time of the day. The function reads the file line by line and calculates the number of seconds...

  • >Assessment Due in 14 hours, 5 minutes. Due Thu 04/04/2019 12:00 pm er is leaking out...

    >Assessment Due in 14 hours, 5 minutes. Due Thu 04/04/2019 12:00 pm er is leaking out of an inverted conical tank at a rate of 10500 cubic centimeters per min at the same time that water Wat is being pumped into the tank at a constant rate. The tank has height 15 meters and the diameter at the top is 6 meters. If r level is rising at a rate of 25 centimeters per minute when the height of the...

  • Write a function that takes two ints and returns the average (float) of those two ints....

    Write a function that takes two ints and returns the average (float) of those two ints. Include a function prototype. In main, call the function with two int inputs of your choice and print the returned value to the output window. The function should not print, just make the calculation an return the average. C language not C++

  • Programming challenge description: Write a program that, given two clock times, prints out the absolute number...

    Programming challenge description: Write a program that, given two clock times, prints out the absolute number of minutes between them. Input: Your program should read lines from standard input. Each line contains two wall clock times separated by a hyphen. Wall clock time is defined as hh:mm followed by AM' or 'PM', e.g. '09:05 AM' Output: Print to standard output the number of minutes between the two times from standard input. Print out each result on a new line. Test...

  • Write a function PoundsToKilograms that: Takes a number of pounds (an integer) as a parameter, Calculates...

    Write a function PoundsToKilograms that: Takes a number of pounds (an integer) as a parameter, Calculates and returns the corresponding value in kilograms. 1 kilogram is equal to 2.2 pounds. In the main section of the program: Prompt the user to input a weight in pounds, Call the function you wrote to transform the weight into kilograms, Output the weight in kilograms; the number must be shown with 2 decimals after the decimal point. Your program must define and call...

  • Write a function that takes two arguments, both strings. Print "YES" if the second string argument...

    Write a function that takes two arguments, both strings. Print "YES" if the second string argument contains only characters found in the first string argument. Print "NO" if the second string argument contains characters not in the first. Here are some sample calls. In your program, call the function 3 times with the same arguments shown below. makeStr("hello", "") makeStr("hello", "olleloheloeloheloel") makeStr("hello", "olleloheloteloheloel") # YES # YES # NO

  • A) Write a function that receives an integer decimal number and converts it to its Hexadecimal...

    A) Write a function that receives an integer decimal number and converts it to its Hexadecimal equivalent B) Write a function that converts a binary number to its corresponding Decimal equivalent BOTH A AND B IN ARDUINO C LANGUAGE

  • Part 3 (Lab2a) In this exercise you will: a. Write a method called secondTime that takes...

    Part 3 (Lab2a) In this exercise you will: a. Write a method called secondTime that takes as argument an integer corresponding to a number of seconds, computes the exact time in hours, minutes and seconds, then prints the following message to the screen: <inputseconds> seconds corresponds to: <hour> hours, <minute> minutes and <second> seconds Write another method called in Seconds that takes as arguments three integers: hours, minutes and seconds, computes the exact time in seconds, then returns the total...

  • help Question 12 (20 points) Write a function named inverse that takes a single parameter, a...

    help Question 12 (20 points) Write a function named inverse that takes a single parameter, a dictionary. In this key is a student, represented by a string. The value of each key is a list of courses, each represented by a string, in which the student is enrolled. dictionary each The function inverse should compute and return a dictionary in which each key is a course and the associated value is a list of students enrolled in that course For...

  • WestEast Bank is a busy metropolitan bank open to customers from 9:00 am to 4:00 pm...

    WestEast Bank is a busy metropolitan bank open to customers from 9:00 am to 4:00 pm each day. It employs both full-time and part-time tellers. Full-timers work 8 hours/day, from 8:00 am to 5:00 pm, with a 1-hour lunch period beginning at either 11:00 am or 12:00 noon. Part-timers work 4 hours/day with no lunch break. Part-timers report for work at the beginning of the hour for the period they are hired. Full-time tellers earn P1,000 for an 8-hour workday,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT