Only Explain How This C++ Program Is working. write a Description/Explanation. Here's The program statement/Requirement, Just For your Understanding. Write a program which accepts days as integer and display the total number of years, months and days in it. E.g. If user input as 856 days the output should be 2 years 4 months 6 days.(consider one month=30 days) Code: #include using namespace std; int main() { int Number_of_days,years,months,dys; cout<<"Enter number of days : "; cin>>Number_of_days; years=Number_of_days/365; Number_of_days=Number_of_days%365; months=Number_of_days/30; dys=Number_of_days%30; cout<<"Years : "<
Only Explain How This C++ Program Is working. write a Description/Explanation. Here's The program statement/Requirement, Just For your Understanding. Write a program which accepts days as integer and display the total number of years, months and days in it. E.g. If user input as 856 days the output should be 2 years 4 months 6 days.(consider one month=30 days) Code: #include using namespace std; int main() { int Number_of_days,years,months,dys; cout<<"Enter number of days : "; cin>>Number_of_days; years=Number_of_days/365; Number_of_days=Number_of_days%365; months=Number_of_days/30; dys=Number_of_days%30; cout<<"Years : "<
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 6PE
Related questions
Question
100%
Only Explain How This C++ Program Is working. write a Description/Explanation.
Here's The program statement/Requirement, Just For your Understanding.
Write a program which accepts days as integer and display the total number of years, months and days in it. E.g. If user input as 856 days the output should be 2 years 4 months 6 days.(consider one month=30 days)
Code:
#include<iostream>
using namespace std;
int main()
{
int Number_of_days,years,months,dys;
cout<<"Enter number of days : "; cin>>Number_of_days;
years=Number_of_days/365;
Number_of_days=Number_of_days%365;
months=Number_of_days/30;
dys=Number_of_days%30;
cout<<"Years : "<<years<<"\nMonths : "<<months<<"\nDays : "<<dys;
return 0;
}
Output:
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage