![jacob7542](/avatars/6494.jpg)
jacob7542
05.03.2020 •
Computers and Technology
• Write a program that asks the user to enter a number of seconds. • If there are less than 60 seconds input, then the program should display the number of seconds that was input. • There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds (note that ther
Solved
Show answers
More tips
- D Dating, Love, Relationships 10 Useful Tips on How to Survive a Breakup?...
- F Food and Cooking Apple Cider Vinegar: The Ultimate Health and Beauty Solution...
- C Computers and Internet Е-head: How it Simplifies Life for Users?...
- F Family and Home How to Choose the Best Diapers for Your Baby?...
- F Family and Home Parquet or laminate, which is better?...
- L Leisure and Entertainment How to Properly Wind Fishing Line onto a Reel?...
- L Leisure and Entertainment How to Make a Paper Boat in Simple Steps...
- T Travel and tourism Maldives Adventures: What is the Best Season to Visit the Luxurious Beaches?...
- H Health and Medicine Kinesiology: What is it and How Does it Work?...
- O Other How to Choose the Best Answer to Your Question on The Grand Question ?...
Answers on questions: Computers and Technology
- C Computers and Technology Which tab allows you to modify the width of page margins in microsoft word?...
- C Computers and Technology I REALLY NEED HELP WITH SCHEME: In Scheme, source code is data. Every non-atomic expression is written as a Scheme list, so we can write procedures that manipulate other...
- C Computers and Technology Which are effective thesis statements? Check all that apply. In this paper, I will talk about healthy foods. Adopting a positive attitude can reduce stress, prevent anxiety,...
- C Computers and Technology When my kid asks about 2020 in the future...
- M Mathematics If the legs of a triangle are 2 and 3 inches can the hypotenuse be 4 inches ?...
- M Mathematics How do I solve? 4a^2+4x-15...
- M Mathematics Parts of an algebraic expression separated by plus or minus signs are...
- E English What is the central idea of This life by Rita Dove...
- M Mathematics What is the value of b in this equation? b- 2 = 18...
- M Mathematics If you toss 3 dices, what is the chance to get at least one 3?...
Ответ:
Here is the program in C++. Let me know if you want this program in some other programming language.
#include <iostream> //for input output functions
using namespace std;//to detect objects like cin cout
int main()//start of main() function body
{ int seconds; // stores the value of seconds
int time; // stores value to compute minutes hours and days
cout << "Enter a number of seconds: ";
//prompts user to enter number of seconds
cin >> seconds; // reads the value of seconds input by user
if (seconds <= 59) //if the value of seconds is less than or equal to 59
{ cout << seconds<<" seconds\n"; } //displays seconds
else if (seconds >= 60 && seconds < 3600)
//if value of seconds is greater than or equal to 60 and less than 3600
{ time = seconds / 60; //computes minutes
cout << time << " minutes in "<<seconds<<" seconds \n "; }
//displays time in minutes
else if (seconds >= 3600 && seconds < 86400) {
//if input value of secs is greater than or equal to 3600 and less than 85400
time = seconds / 3600; //calculate hours in input seconds
cout << time << " hours in "<<seconds<<" seconds \n"; }
//displays the time in hours
else if (seconds >= 86400) { //if seconds is greater or equal to 86400
time = seconds / 86400; //compute the days
cout << time << " days in "<<seconds<<" seconds \n"; } }
//displays the number of days in input number of seconds
Explanation:
This program first prompts the user to enter the time in seconds and computes the number of minutes, hour or days according to the conditions specified in the program. If the value of seconds entered by the user is less than or equal to 59, the number of seconds are displayed as output, otherwise the if and else if conditions are checked if the input value of seconds is greater than 60 to compute the corresponding minutes, hours or days. Everything is explained within the comments in the program.You can change the data type of time variable from int to float to get the value floating point numbers. Here i am using int to round the time values. The screenshot of the output is attached.
Ответ:
you didnt post the answer choices :/ if theres none it is supplies?
Explanation: