Complete the function ConvertToDecadesAnd Years to convert totalYears to decades and years. Return decades and years us the Elapsed Decades Years struct. Ex: 26 years is 2 decades and 6 years. 1 #include 2 3 typedef struct ElapsedDecades Years_struct { 4 int decadesVal; 5 int yearsVal; 63 ElapsedDecadesYears; 7 8 ElapsedDecades Years ConvertToDecadesAndYears (int totalYears) { O FlapsedDecadesYears tempVal:
Complete the function ConvertToDecadesAnd Years to convert totalYears to decades and years. Return decades and years us the Elapsed Decades Years struct. Ex: 26 years is 2 decades and 6 years. 1 #include 2 3 typedef struct ElapsedDecades Years_struct { 4 int decadesVal; 5 int yearsVal; 63 ElapsedDecadesYears; 7 8 ElapsedDecades Years ConvertToDecadesAndYears (int totalYears) { O FlapsedDecadesYears tempVal:
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
Related questions
Question
![Complete the function ConvertToDecadesAnd Years to convert totalYears to decades and years. Return decades and years using
the ElapsedDecades Years struct. Ex: 26 years is 2 decades and 6 years.
1 #include <stdio.h>
2
3 typedef struct ElapsedDecadesYears_struct {
int decadesVal;`
5
int yearsVal;
6) ElapsedDecadesYears;
7
8 Elapsed Decades Years ConvertToDecadesAndYears(int totalYears) {
ElapsedDecades Years tempVal;
/* Your code goes here */
15 int main(void) {
8722878
25
26 }
ElapsedDecadesYears elapsedYears;
int totalYears;
scanf("%d", &totalYears);
elapsedYears = ConvertToDecadesAndYears (totalYears);
printf("%d decades and %d years\n", elapsedYears.decadesVal, elapsedYears.yearsVal);
return 0;](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F2607c80f-78e3-4cea-850b-2b41054ecd85%2Fa16e9a2d-a91a-433c-97e8-b4155e109840%2Fimvz69_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Complete the function ConvertToDecadesAnd Years to convert totalYears to decades and years. Return decades and years using
the ElapsedDecades Years struct. Ex: 26 years is 2 decades and 6 years.
1 #include <stdio.h>
2
3 typedef struct ElapsedDecadesYears_struct {
int decadesVal;`
5
int yearsVal;
6) ElapsedDecadesYears;
7
8 Elapsed Decades Years ConvertToDecadesAndYears(int totalYears) {
ElapsedDecades Years tempVal;
/* Your code goes here */
15 int main(void) {
8722878
25
26 }
ElapsedDecadesYears elapsedYears;
int totalYears;
scanf("%d", &totalYears);
elapsedYears = ConvertToDecadesAndYears (totalYears);
printf("%d decades and %d years\n", elapsedYears.decadesVal, elapsedYears.yearsVal);
return 0;
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
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
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT