Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JUST IN C Write a program to ask the user to enter a number of seconds. If the number of seconds entered is less than

image text in transcribedJUST IN C

Write a program to ask the user to enter a number of seconds. If the number of seconds entered is less than 1, inform the user and exit the program. If the number of seconds entered is 60 (the number of seconds in 1 minute) or more, display the number of minutes in that many seconds. If the number of seconds entered is 3600 (the number of seconds in 1 hour) or more, display the number of hours in that many seconds. If the number of seconds entered is 86,400 (the number of seconds in 1 day) or more, display the number of days in that many seconds.

Create constants for the number of seconds in a minute, an hour, and a day. Format all the calculated outputs to 2 decimal places.

Hint: You will need 3 separate if statements (not including the validation for numbers less than 1) for this program.

Example Run #1: (bold type is what is entered by the user)

Enter the number of seconds: 65

The number of seconds you entered, 65, is x.xx minutes.

Example Run #2:

Enter the number of seconds: 100000

The number of seconds you entered, 100000, is xxxx.xx minutes. The number of seconds you entered, 100000, is xx.xx hours. The number of seconds you entered, 100000, is x.xx days.

Example Run #3:

Enter the number of seconds: 0 The number of seconds entered must be greater than 0.

The example runs show EXACTLY how your program input and output will look.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago