Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C program that provides each of the following tasks as separate functions. 1- Calculate the result of following formula: f(x) = 2 =
Write a C program that provides each of the following tasks as separate functions. 1- Calculate the result of following formula: f(x) = 2 = xi i0 = 1+x+ + x x + + ... 2- Calculate the Roots of Quadratic Formula A quadratic equation can have either one or two distinct real or complex roots depending upon nature of discriminant of the equation. Where discriminant of the quadratic equation is given by A = b2 - 4*a*c If discriminant is positive. Then there are two real distinct roots given by. -b+VA 2.a and -b-VA 2.a 3- Perfect Number Checker A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For instance, 6 has divisors 1, 2 and 3 (excluding itself), and 1 + 2 + 3 = 6, so 6 is a perfect number. For instance, 28 is perfect as 1 + 2 + 4 + 7 + 14 = 28. 4- Prime Number Checker 5- Binary to Decimal Conversion 6- Exit Write an additional function menu which has the following prototype; int menu (void); Function menu() let user select an option between the numbers given above 1 and 6. The proper function based on the return value of menu() must be called in an infinite loop in main() function. The program must continue as long as user does not enter 6. SAMPLE OUTPUTS: **SELECT AN OPTION BELOW** Write a function to calculate the formula f(x) - 1 + x + x^2/2! + x^3/3! + x^4/4 + ... 2 - Roots of Quadratic Formula - Perfect Number Function 4 - Prime Number Function 5 - Convert Binary to Decimal 6 - Exit.. Enter x and the limit..>1 3 The result is 2.67 **SELECT AN OPTION BELOW** 1 - Write a function to calculate the formula f(x) = 1 + x + x^2/21 + x^3/3! + x^4/4! + .. 2 - Roots of Quadratic Formula 3 - Perfect Number Function 4 - Prime Number Function 5 - Convert Binary to Decimal 6 - Exit.. SESELECT AN OPTION BELOW 1 - Write a function to calculate the formula f(x) - 1 + x + x^2/21 + x^3/3! + x^4/4! + ... Roots of Quadratic Formula 3 - Perfect Number Function - Prime Number Function 5 - Convert Binary to Decimal Exit.. Enter x and the limit..>2 3 The result is 6.33 CESELECT AN OPTION BELOW Write a function to calculate the formula f(x) = 1 + x + x^2/2! + x^3/3! + x^4/4! + ... - Roots of Quadratic Formula - Perfect Number Function 4 - Prime Number Function - Convert Binary to Decimal 6 - Exit.. Enter coefficients a, b and c: 25-3 rooti - 0.5e and root2 = -3.ee **SELECT AN OPTION BELOW** 1 - Write a function to calculate the formula f(x) - 1 + x + x^2/2! + x^3/31 + x^4/4! + .. Roots of Quadratic Formula Perfect Number Function 4 - Prime Number Function 5 - Convert Binary to Decimal 6 - Exit.. Enter a number for perfect number checking> 28 The number 28 is perfect.. Enter a number for perfect number checking> 33 The number 33 is NOT Perfect. **SELECT AN OPTION BELOW** 1 - Write a function to calculate the formula f(x) - 1 + x + x^2/21 + x^3/31 + x^4/4! + ... 2 - Roots of Quadratic Formula Perfect Number Function 4 - Prime Number Function Convert Binary to Decimal 6 - Exit.. Enter a number for prime number checking) 17 The number 17 is Prime Enter a number for prime number checking> 16 The number 16 is NOT Prime. RESELECT AN OPTION BELOW* 1 - Write a function to calculate the formula f(x) = 1 + x + x^2/2! + x^3/3! + x^4/4! + .. 2 - Roots of Quadratic Formula 3 - Perfect Number Function 4 - Prime Number Function 5 - Convert Binary to Decimal 6 - Exit.. Enter a number in binary form> 11111 Decimal equivalent of 11111 is 31.. Enter a number in binary form> 1001 Decimal equivalent of 1001 is 9
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started