Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 1 : Program Design, implement, compile, and test C solutions to the following problems. Write a program that prompts the user for two integer
Part : Program
Design, implement, compile, and test C solutions to the following problems.
Write a program that prompts the user for two integer numbers called numberint and numberint and two floatingpoint numbers called numberfloat and numberfloat
The code for declaring the variables and prompting the user is given below please write the code into your c file:
image.png
Perform the following operations on the numbers:
Add numberint and numberint together and print the result as an integer value.
Subtract numberfloat from numberfloat and print the result as a floatingpoint value.
Multiply numberint by numberfloat and print the result as an integer value.
Divide numberint by numberint and print the result as an integer and a floatingpoint value Ask yourself: What happens when you divide an integer by an integer? Does the result change because you print it as a floatingpoint number?
Divide numberint by numberfloat and print the result as an integer and a floatingpoint value Ask yourself: How does this compare to the previous operations? We are now dealing with mixed data types
Explicitly cast numberint as a floatingpoint value and divide by numberint. Print the result as a floatingpoint value.
Try to mod numberfloat by numberfloat. Does the program compile? If not, fix it so that it does.
Determine if numberint and numberint are even or odd. Print if even and if odd. You may not use if statements. Use the mod operator instead.
V Part :
Write a program that prompts the user for inputs into Joules Law and determines the power. Print the power value. Joule's Law: P V R where P is the power, V is the voltage, and R is the resistance of the circuit all values are integers Do we have loss of precision? What kind of division is being performed?
Write a program that prompts the user for inputs into the thirdorder polynomial equation provided and determines the y value. Print the y value. The thirdorder polynomial equation is: y a x b x c x d x y a b c and d are integer numbers Be careful here! What is as an integer result? We do not want integer division in this case! How do we fix it Do we ultimately have loss of precision?
Write a program that prompts the user for inputs into the circumference of a circle equation provided and determines the circumference value. Print the circumference value. Circumference of a circle: circumference PI radius circumference and radius are floatingpoint numbers; PI should be defined as a constant floatingpoint number and should not be entered by the user
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