Computer Science: A Structured Programming Approach Using C, Third Edition
Computer Science: A Structured Programming Approach Using C, Third Edition
3rd Edition
ISBN: 9780534491321
Author: Behrouz A. Forouzan, Richard F. Gilberg
Publisher: Course Technology, Inc.
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 5, Problem 62PS

Write a menu-driven program that allows a user to enter five numbers and then choose between finding the smallest, largest, sum, or average. The menu and all the choices are to be functions. Use a switch statement to determine what action to take. Provide an error message if an invalid choice is entered.

Run the program five times, once with each option and once with an invalid option. Each run is to use the following set of data:

18 ,   21 ,   7 ,   54 ,   9

Blurred answer
Students have asked these similar questions
Write a program that will perform one of the following operations:1. Print the Fibonacci series from 0 to N2. Print the Prime numbers from 0 to N3. Print the Factorial of the numbers from 0 to NInclude at least the following functions in your program:• menu: a function to display the operations listed aboveo Use a switch-statement to process the user’s choice• fibonacci: a function that will print the Fibonacci series from 0 to N o Sample Input: Suppose N = 5o Sample Output: 0 1 1 2 3 5 • primeNumbers: a function that will print the prime numbers from 0 to N o Sample Input: Suppose N = 5o Sample Output: 2 3 5 • factorial: a function that will print the factorials of the numbers from 0 to N o Sample Input: Suppose N = 5o Sample Output: 0! 1! 2! 3! 4! 5! = 1 1 2 6 24 120 Include a loop that will allow the user to repeat the whole program if he wants to.   PLEASE add "//" every code wirtten to explain its use in the program. thank you! do the following conditions set and DO IT IN C++
In C write a simple scientific calculator program as follows:Display a menu of options according to table.Ask the user to enter a menu option (upper and lower case will work).If menu option is not valid, display msg “invalid option” and repeat parts 1 and 2. (use do-while)For “add” option ask the user to enter two numbers, store as double and display sum.For subtract option ask the user to enter two numbers, store as double and display difference.For multiply option, same as above.For divide option, same as above (test the denominator, if zero, display an appropriate msg).For squared, ask the user to input a number and output the square of the number.For square root, check if the number is negative and output appropriate msg, otherwise, output solution.For factorial, ask for a number an output factorial ( 5! = 5*4*3*2*1). (use for loop)For absolute value, output the absolute value of a given number.For greater integer, round the number to an integer greater than number.For leap year,…
8. Write a program: a menu-driven automatic teller program in which the user's bank balance is initialized to 2000 USD. The user should be allowed to perform as many transactions as he or she wishes from the menu. 1. Deposit 2. Withdrawal 3.See Balance 4.Exit For the withdrawal option, the user should be prompted to select from the choices $50, S100, S200, and S500 (do not allow the user to over draw). After each transaction, the program should print the current balance.

Chapter 5 Solutions

Computer Science: A Structured Programming Approach Using C, Third Edition

Ch. 5 - There are two different ways to implement a...Ch. 5 - Which of the following statements about switch...Ch. 5 - Which of the following statements about the...Ch. 5 - Prob. 14PSCh. 5 - Prob. 15PSCh. 5 - If x=0,y=5,z=5, what is the value of x, y, and z...Ch. 5 - If x=3,y=0,andz=4, what is the value of the...Ch. 5 - Simplify the following expressions by removing the...Ch. 5 - Prob. 19PSCh. 5 - If originally x=4,y=0,andz=2, what is the value of...Ch. 5 - If originally x=4,y=0,andz=2, what is the value of...Ch. 5 - If originally x=4,y=0,andz=2, what is the value of...Ch. 5 - If originally x=4,y=0,andz=2, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=4,y=0,andz=2, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=2,y=1,andz=1, what is the value of...Ch. 5 - If originally x=1,y=3,andz=0, what is the value of...Ch. 5 - Evaluate the value of the following expressions:...Ch. 5 - Evaluate the value of the following expressions:...Ch. 5 - Write an if statement that will assign the value 1...Ch. 5 - Prob. 36PSCh. 5 - Write the code to add 4 to an integer variable,...Ch. 5 - Prob. 38PSCh. 5 - Write the code to print either zero or not zero...Ch. 5 - If the variable divisor is not zero, divide the...Ch. 5 - Prob. 41PSCh. 5 - Rewrite the following code using one if statement:...Ch. 5 - Rewrite the following code fragment using one...Ch. 5 - Write a code fragment that tests the value of an...Ch. 5 - Prob. 45PSCh. 5 - Prob. 46PSCh. 5 - Write a function called smallest that, given three...Ch. 5 - Prob. 48PSCh. 5 - Write a function called month_of_year that, given...Ch. 5 - Write a function called parkingcharge that, given...Ch. 5 - Prob. 51PSCh. 5 - Complete the incremental implementation of Program...Ch. 5 - Write a program that determines a student's grade....Ch. 5 - Prob. 54PSCh. 5 - Given a point, a line from the point forms an...Ch. 5 - Prob. 56PSCh. 5 - Write a program that asks the user to enter the...Ch. 5 - Prob. 58PSCh. 5 - This program is a simple guessing game. The...Ch. 5 - Write a program that, given a person's birth date...Ch. 5 - Write a program that calculates the change due a...Ch. 5 - Write a menu-driven program that allows a user to...Ch. 5 - Write a program that tests a user-entered...Ch. 5 - Write a program to compute the real roots of a...
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Introduction to Operators in C; Author: Neso Academy;https://www.youtube.com/watch?v=50Pb27JoUrw;License: Standard YouTube License, CC-BY