Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please help fix this C program Please don't use cin and count statements #include (15 flex) a pre te Sint calculate_forx(int x); /*

Can you please help fix this C program

Please don't use cin and count statements

image text in transcribed

image text in transcribed

#include (15 flex) a pre te Sint calculate_forx(int x); /* variable for normal quadratic formula int Recursive Quadratic(int x); /* variable for recursive quadratic formula th o int mainga inty.x / declaring variables for normal formula char choice. I creating option for user to place an integer y dee what unit whe 7 do "initiating the achieving of an integer and placing and receiving from both formulas & the prototypen) blank lines in bland before input printf("This program calculates f(x) in 2 ways"); printf(in Enter positive value for x: "); scanf("%d", &x); * reads users input - make sure yo y = calculate_forx(x): * defining calling formula printf("f(x) = %d ". y); prints sum wlidite don't You y* RecursiveQuadratic(x): 1" defining calling formula printf("Using quadratic f(x) = %d ". y): prints sum " printf("Do you want to continue?"), now? do l'initiating a choice for user to continue or stop odd organization scanf("%c", &choice); while (choice "n") if (choice == 'n' || choice == 'N') cimmt contain goturno: nope- put the condition ina. while (0-0) Ciment antin * testing the function 2z^2+4 +6 / int calculate_forx(int z); integer for x inputted into normal formula 'l- Spaca int fofx, sum=0; re formula is 2z^2+42+6. f(z+1) = f(z)+4"z(ie 2a)+6(a+b), f(0) = 6 so for example, f(1) = f(0)+4*z+6=6+10=16 / should be * Another example is f(2)=f(1)+42+6 = 16+4+2+6=16+14=30*/ while (z-1) > 0) {"bases of the formula 1 one line sum += 4 *z +6; 2 * 2 * 2 + 4 x 3 + 6 -Z; sum += 6: return sum; return to main to be printed 3 spaces int RecursiveQuadratic(int z): if (z == 0) comment incent yeturn 6; integer for z inputted from x * fo +(0) 63 poent else e turn RecursiveQuadratic(z - 1) + 4* z+6; * return to main to be printed

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_2

Step: 3

blur-text-image_3

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

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions