Question
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
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 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started