#include void main() { // variables to store input values for account balance and interest rate float balance, rate; // variables to store option and choice input int option, choice; int i, j; // loop counters // outer loop to allows the user to repeat this calculation for a new balance and interest rate while(choice != 0) { // asking and storing user input printf("Bank Account Balance: "); scanf("%f", &balance); printf("Interest Rate: "); scanf("%f", &rate); // printing mod menu and storing input for that printf("Mode Menu\n [1] Annually\n [2] Monthly\n"); printf("Option: "); scanf("%d", &option); // if selected option is 1 if(option == 1) { // printing mode selected printf("Annually Interest\n"); // for 5 years for(i=1; i<=5; i++) { // computing balance by adding interest balance = balance + balance*rate/100.0; // printing balance printf("Bank Account Balance in Year %d: %.2f\n", i, balance); } } // if option 2 is selected else if(option == 2) { // printing mode selected printf("Monthly Interest\n"); // for 5 years for(i=1; i<=5; i++) { // printing year number printf("Year %d\n", i); // for 12 months of each year for(j=1; j<=12; j++) { // computing balance according to monthly interest rate balance = balance + balance*rate/(12*100.0); // printing balance printf("Bank Account Balance in Month %d: %.2f\n", j, balance); } } } // for invalid options print invalid else { printf("Invalid Option!"); } // asking if user wants to continue or exit printf("Do you want to continue?\n [0] No\n [1] Yes\n"); printf("Choice: "); scanf("%d", &choice); // storing choice } } Please help how to fix my code? it says "Terminated by timeout" OUTPUT 1 Bank Account Balance: 100 Interest Rate: 5 Mode Menu [1] Annually [2] Monthly Option: 1 Annually Interest Bank Account Balance in Year 1: 105.00 Bank Account Balance in Year 2: 110.25 Bank Account Balance in Year 3: 115.76 Bank Account Balance in Year 4: 121.55 Bank Account Balance in Year 5: 127.63 OUTPUT 2 Bank Account Balance: 100 Interest Rate: 5 Mode Menu [1] Annually [2] Monthly Option: 2 Monthly Interest Year 1 Bank Account Balance in Month 1: 100.42 Bank Account Balance in Month 2: 100.84 Bank Account Balance in Month 3: 101.26 Bank Account Balance in Month 4: 101.68 Bank Account Balance in Month 5: 102.10 Bank Account Balance in Month 6: 102.53 Bank Account Balance in Month 7: 102.95 Bank Account Balance in Month 8: 103.38 Bank Account Balance in Month 9: 103.81 Bank Account Balance in Month 10: 104.25 Bank Account Balance in Month 11: 104.68 Bank Account Balance in Month 12: 105.12 Year 2 Bank Account Balance in Month 1: 105.55 Bank Account Balance in Month 2: 105.99 Bank Account Balance in Month 3: 106.44 Bank Account Balance in Month 4: 106.88 Bank Account Balance in Month 5: 107.32 Bank Account Balance in Month 6: 107.77 Bank Account Balance in Month 7: 108.22 Bank Account Balance in Month 8: 108.67 Bank Account Balance in Month 9: 109.12 Bank Account Balance in Month 10: 109.58 Bank Account Balance in Month 11: 110.04 Bank Account Balance in Month 12: 110.49 Year 3 Bank Account Balance in Month 1: 110.95 Bank Account Balance in Month 2: 111.42 Bank Account Balance in Month 3: 111.88 Bank Account Balance in Month 4: 112.35 Bank Account Balance in Month 5: 112.82 Bank Account Balance in Month 6: 113.29 Bank Account Balance in Month 7: 113.76 Bank Account Balance in Month 8: 114.23 Bank Account Balance in Month 9: 114.71 Bank Account Balance in Month 10: 115.19 Bank Account Balance in Month 11: 115.67 Bank Account Balance in Month 12: 116.15 Year 4 Bank Account Balance in Month 1: 116.63 Bank Account Balance in Month 2: 117.12 Bank Account Balance in Month 3: 117.61 Bank Account Balance in Month 4: 118.10 Bank Account Balance in Month 5: 118.59 Bank Account Balance in Month 6: 119.08 Bank Account Balance in Month 7: 119.58 Bank Account Balance in Month 8: 120.08 Bank Account Balance in Month 9: 120.58 Bank Account Balance in Month 10: 121.08 Bank Account Balance in Month 11: 121.58 Bank Account Balance in Month 12: 122.09 Year 5 Bank Account Balance in Month 1: 122.60 Bank Account Balance in Month 2: 123.11 Bank Account Balance in Month 3: 123.62 Bank Account Balance in Month 4: 124.14 Bank Account Balance in Month 5: 124.65 Bank Account Balance in Month 6: 125.17 Bank Account Balance in Month 7: 125.70 Bank Account Balance in Month 8: 126.22 Bank Account Balance in Month 9: 126.74 Bank Account Balance in Month 10: 127.27 Bank Account Balance in Month 11: 127.80 Bank Account Balance in Month 12: 128.34 This is the OUTPUT

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

#include<stdio.h>

void main()
{
// variables to store input values for account balance and interest rate
float balance, rate;
// variables to store option and choice input
int option, choice;
int i, j; // loop counters

// outer loop to allows the user to repeat this calculation for a new balance and interest rate
while(choice != 0)
{
// asking and storing user input
printf("Bank Account Balance: ");
scanf("%f", &balance);
printf("Interest Rate: ");
scanf("%f", &rate);

// printing mod menu and storing input for that
printf("Mode Menu\n [1] Annually\n [2] Monthly\n");
printf("Option: ");
scanf("%d", &option);

// if selected option is 1
if(option == 1)
{
// printing mode selected
printf("Annually Interest\n");
// for 5 years
for(i=1; i<=5; i++)
{
// computing balance by adding interest
balance = balance + balance*rate/100.0;
// printing balance
printf("Bank Account Balance in Year %d: %.2f\n", i, balance);
}
}
// if option 2 is selected
else if(option == 2)
{
// printing mode selected
printf("Monthly Interest\n");
// for 5 years
for(i=1; i<=5; i++)
{
// printing year number
printf("Year %d\n", i);
// for 12 months of each year
for(j=1; j<=12; j++)
{
// computing balance according to monthly interest rate
balance = balance + balance*rate/(12*100.0);
// printing balance
printf("Bank Account Balance in Month %d: %.2f\n", j, balance);
}
}
}
// for invalid options print invalid
else
{
printf("Invalid Option!");
}

// asking if user wants to continue or exit
printf("Do you want to continue?\n [0] No\n [1] Yes\n");
printf("Choice: ");
scanf("%d", &choice); // storing choice
}
}

Please help how to fix my code? it says "Terminated by timeout"

OUTPUT 1
Bank Account Balance: 100
Interest Rate: 5
Mode Menu
[1] Annually
[2] Monthly
Option: 1
Annually Interest
Bank Account Balance in Year 1: 105.00
Bank Account Balance in Year 2: 110.25
Bank Account Balance in Year 3: 115.76
Bank Account Balance in Year 4: 121.55
Bank Account Balance in Year 5: 127.63
OUTPUT 2
Bank Account Balance: 100
Interest Rate: 5
Mode Menu
[1] Annually
[2] Monthly
Option: 2
Monthly Interest
Year 1
Bank Account Balance in Month 1: 100.42
Bank Account Balance in Month 2: 100.84
Bank Account Balance in Month 3: 101.26
Bank Account Balance in Month 4: 101.68
Bank Account Balance in Month 5: 102.10
Bank Account Balance in Month 6: 102.53
Bank Account Balance in Month 7: 102.95
Bank Account Balance in Month 8: 103.38
Bank Account Balance in Month 9: 103.81
Bank Account Balance in Month 10: 104.25
Bank Account Balance in Month 11: 104.68
Bank Account Balance in Month 12: 105.12
Year 2
Bank Account Balance in Month 1: 105.55
Bank Account Balance in Month 2: 105.99
Bank Account Balance in Month 3: 106.44
Bank Account Balance in Month 4: 106.88
Bank Account Balance in Month 5: 107.32
Bank Account Balance in Month 6: 107.77
Bank Account Balance in Month 7: 108.22
Bank Account Balance in Month 8: 108.67
Bank Account Balance in Month 9: 109.12
Bank Account Balance in Month 10: 109.58
Bank Account Balance in Month 11: 110.04
Bank Account Balance in Month 12: 110.49
Year 3
Bank Account Balance in Month 1: 110.95
Bank Account Balance in Month 2: 111.42
Bank Account Balance in Month 3: 111.88
Bank Account Balance in Month 4: 112.35
Bank Account Balance in Month 5: 112.82
Bank Account Balance in Month 6: 113.29
Bank Account Balance in Month 7: 113.76
Bank Account Balance in Month 8: 114.23
Bank Account Balance in Month 9: 114.71
Bank Account Balance in Month 10: 115.19
Bank Account Balance in Month 11: 115.67
Bank Account Balance in Month 12: 116.15
Year 4
Bank Account Balance in Month 1: 116.63
Bank Account Balance in Month 2: 117.12
Bank Account Balance in Month 3: 117.61
Bank Account Balance in Month 4: 118.10
Bank Account Balance in Month 5: 118.59
Bank Account Balance in Month 6: 119.08
Bank Account Balance in Month 7: 119.58
Bank Account Balance in Month 8: 120.08
Bank Account Balance in Month 9: 120.58
Bank Account Balance in Month 10: 121.08
Bank Account Balance in Month 11: 121.58
Bank Account Balance in Month 12: 122.09
Year 5
Bank Account Balance in Month 1: 122.60
Bank Account Balance in Month 2: 123.11
Bank Account Balance in Month 3: 123.62
Bank Account Balance in Month 4: 124.14
Bank Account Balance in Month 5: 124.65
Bank Account Balance in Month 6: 125.17
Bank Account Balance in Month 7: 125.70
Bank Account Balance in Month 8: 126.22
Bank Account Balance in Month 9: 126.74
Bank Account Balance in Month 10: 127.27
Bank Account Balance in Month 11: 127.80
Bank Account Balance in Month 12: 128.34

This is the OUTPUT

Codio
Project
File
Edit
Find
View
Tools
Education
Help
A Compile & Run
• Project Index (static)
O Debug Current File
task3.c
4. Task 3: Using a...
34
balance = balance + balance*rate/100.0;
// printing balance
printf("Bank Account Balance in Year %d: %.2f\n", i, balanc
}
}
// if option 2 is selected
else if(option == 2)
{
// printing mode selected
printf("Monthly Interest\n");
// for 5 years
for (i=1; i<=5; i++)
{
35
Collapse
36
37
4. Task 3: Using a nested loop
38
39
COMPILE!
40
41 v
42
43
Command was successfully executed.
44
45
46 v
// printing year number
printf("Year %d\n", i);
// for 12 months of each year
for (j=1; j<=12; j++)
{
// computing balance according to monthly interest rate
balance = balance + balance*rate/(12*100.0);
// printing balance
printf("Bank Account Balance in Month %d: %.2f\n", j, b
}
47
48
RUN!
49
50
51 v
task3
52
53
NOTE:
54
Submit when you are ready.
55
56
You must click the Check It button to submit your codes and be
57
graded.
}
// for invalid options print invalid
58
You MUST passed all the checklist below.
59
60
else
Check It!
61 -
{
printf("Invalid Option!");
}
62
63
LAST RUN on 3/2/2021, 10:55:20 PM
64
Terminated by timeout
// asking if user wants to continue or exit
printf("Do you want to continue?\n [0] No\n [1] Yes\n");
printf("Choice: ");
scanf("%d", &choice); // storing choice
}
65
66
67
68
69
70
}
Next
100% (70:1)
Transcribed Image Text:Codio Project File Edit Find View Tools Education Help A Compile & Run • Project Index (static) O Debug Current File task3.c 4. Task 3: Using a... 34 balance = balance + balance*rate/100.0; // printing balance printf("Bank Account Balance in Year %d: %.2f\n", i, balanc } } // if option 2 is selected else if(option == 2) { // printing mode selected printf("Monthly Interest\n"); // for 5 years for (i=1; i<=5; i++) { 35 Collapse 36 37 4. Task 3: Using a nested loop 38 39 COMPILE! 40 41 v 42 43 Command was successfully executed. 44 45 46 v // printing year number printf("Year %d\n", i); // for 12 months of each year for (j=1; j<=12; j++) { // computing balance according to monthly interest rate balance = balance + balance*rate/(12*100.0); // printing balance printf("Bank Account Balance in Month %d: %.2f\n", j, b } 47 48 RUN! 49 50 51 v task3 52 53 NOTE: 54 Submit when you are ready. 55 56 You must click the Check It button to submit your codes and be 57 graded. } // for invalid options print invalid 58 You MUST passed all the checklist below. 59 60 else Check It! 61 - { printf("Invalid Option!"); } 62 63 LAST RUN on 3/2/2021, 10:55:20 PM 64 Terminated by timeout // asking if user wants to continue or exit printf("Do you want to continue?\n [0] No\n [1] Yes\n"); printf("Choice: "); scanf("%d", &choice); // storing choice } 65 66 67 68 69 70 } Next 100% (70:1)
Expert Solution
steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
Concept of memory addresses in pointers
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education