Home / Expert Answers / Computer Science / convert-totalyears-to-centuries-decades-and-years-finding-the-maximum-number-of-centuries-then-pa656

(Solved): Convert totalYears to centuries, decades, and years, finding the maximum number of centuries, then ...






Convert totalYears to centuries, decades, and years, finding the maximum number of centuries, then decades, then years.
Ex if
Convert totalYears to centuries, decades, and years, finding the maximum number of centuries, then decades, then years. Ex if the input is 515, the output is Centuries: 5 Decades: 1 Years: 5 Note: A century has 100 year's. A decade has 10 years. 2 using nanespace std; 4 int main() \& 5 int totalyears; 6 int numCenturies; 7 Int numbecades; 8. Int numyears; 10 cin \( \gg \) totalyears; 12 13 14 cout ce "Centuries: " ce numCenturies ce end1; 15 tout \&e "Decades: " Ke numbecades «e end1: 16 cout ef -rears: "e numvears «s end1; 11 return o;


We have an Answer from Expert

View Expert Answer

Expert Answer


Required answer:- * Basic approach:- Step-1:- FIrst read the input from user as totalYears. Step-2:- To calculate the number of century, divide the totalYears by 100 and print the result after division then store the reminder again in same variable i
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe