59.2k views
1 vote
Write a program that prompts the user to enter the minutes (e.g., 1 billion), and displays the number of years and days for the minutes. For simplicity, assume a year has 365 days. Here is a sample run: Enter the number of minutes: 1000000000 1000000000 minutes is approximately 1902 years and 214 days

User Blueiur
by
6.0k points

1 Answer

3 votes

Answer:

// here is code in c++.

// include headers

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variables

long long int minutes,years,days;

long long int s;

cout<<"please enter the minutes:";

// read the minutes

cin>>minutes;

// make a copy

s=minutes;

// calculate days

days=minutes/1440;

// calculate years

years=days/365;

// calculate remaining days after years

days=days%365;

// print the result

cout<<s<<" minutes is equal to "<<years<<" years "<<days<<" days."<<endl;

return 0;

}

Step-by-step explanation:

Read the number of minutes from user and assign it to variable "minutes" of long long int type.Make a copy of input minutes.Then calculate total days by dividing the input minutes with 1440, because there is 1440 minutes in a day.Then find the year by dividing days with 365.Then find the remaining days and print the output.

Output:

please enter the minutes:1000000000

1000000000 minutes is equal to 1902 years 214 days.

User Sbr
by
6.2k points