Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need this in c programming assignment is given and also code is given you just have to code the lines where it says TODO

I need this in c programming

assignment is given and also code is given you just have to

code the lines where it says TODO here

please edit the code that i have given and please send me screenshot of the output as well

ITs a single assignment so please do answer both parts

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Part 1. gdb. In this lab, you will learn how to use a debugger on the command line to squash bugs in C programs. At the beginning of the lab, your TA will give an introduction to gdb, The GNU Project Debugger. This introduction will be relatively brief and cover only a small fraction of what GDB has to offer. For those interested in learning more, a complete guide to GDB can be found at ftp://ftp.gnu.org/ old-gnu/Manuals/gdb/html_node/gdb_toc.html. There are also numerous other resources online You are provided two programs to debug and fix as follows fibonacci.c should take an input (n) from user, and calculate and print fibonacci(n). For example, for n-5 it should print 5 (we assume that 0 is the 0th Fibonacci number). The Fibonacci series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, .. whileloop.c prints the number of odd and even number between 0 and 199. Once the program is fixed, it should output odd-100 even-100 Find and fix all syntax errors and bugs in whileloop.c and fibonacci.c, and submit the fixed code. Botlh programs should be fixable with only a few modifications Complete rewrites of any of the programs will not be considered correct solutions Part 2. Fixed deposit calculator A series that depends on i is recursively defined as follows Ao(i) 1000. 1200 The above sequence shows us how much money we would have after n months if we initially deposit 1,000 dollars with fixed annual interest rate i percent. Here we assume i is an integer. We will do the above calculations in our code. The starter code will prompt a user to input a value for n (between 1 and 100) and i (between 1 and 5). For the given value, balance) function in seq.c must compute the value of An(i) using recursion. The main function prints An(i). Do not modify the main function. Your task is limited to the balance function. Do not print anything in the function. You must use the above recurrence for computing the value, do not use other methods. Execution of the program after completing the function must produce the output listed below for the given input $ ./seq Enter n: 100 Enter i:5 After 100 months, $1,000 becomes $1515.58 untitled fibonacci.c x include 3 4 int fibonacci(int n) 6 7 8 9 10 if(n--e) returne: if (n--1) return 1; return fibonacci(-n)+fibonacci(n--); 15 int main(Void) 16 17 18 19 20 21 int n; printf("Enter a number between 1 and 10:") scanf("%d",&n) ; printf("Fibonacci (n)-%d ", fibonacci (n)) ; 23 24 25 26 e fibonacci-c le seq.c x #include 2 #include 3 4/This function calculates the balance after n-th month. 5 n is assumed to be non-negative. i is the annual interest rate in percent. 6 * For example, i 5 means the anual interest rate if 5%. 7 Do not worry about overflow 8 Do not print anything in this function. 10 float balance(int n, int i) 11 f 12 assert(n>-0); 13 14 / TODO 15 / base step 16 17 18 I recursion 19 20 21 23 / do not change the main function 24 int main() int n,i 26 27 printf("Enter n:") 29 30 scanf("%d",&n) ; printf("Enter i:") scanf("%d",&i ) ; 31 32 printf("After return e; %d months, $1,00 becomes $%,2f ", balance(n,i)); 4 35 36 37 n, include 3 4 int main() 6 char i; 8 9 10 int odd, // count the number of odd numbers and even numbers from 0 to 199 while (i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

a. Did you express your anger verbally? Physically?

Answered: 1 week ago

Question

Has the priority order been provided by someone else?

Answered: 1 week ago

Question

Compare the current team to the ideal team.

Answered: 1 week ago