Question
C language Write a program that displays a menu on the screen. The menu will give the user five options - (a) enter two integers,
C language
Write a program that displays a menu on the screen. The menu will give the user five options - (a) enter two integers, (b) enter two floats, (c) enter one integer and one float, (d) enter one float and one double; or (e) quit. The inputs should be labelled a, b, c, d, e; you should enter in the letter to choose the appropriate option. Once the user selects the option, two numbers will be read in from the user. The numbers will be added together and then the result will be displayed on the screen. In the case of (b), adding two float numbers, make sure that the output shows only three digits after the decimal. For the case of (c), adding an int and a float, give two results - the result where you treat the int as a float, and the result where you cast the float to an int. Similarly, in the case of (d), when adding the float and double, give two results: one where you cast neither variable and the other where you cast both to an int.
Run the code with some test cases and upload.
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