Answered step by step
Verified Expert Solution
Link Copied!

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 1: Program
Design, implement, compile, and test C solutions to the following problems.
Write a program that prompts the user for two integer numbers (called number1_int and number2_int) and two floating-point numbers (called number1_float and number2_float).
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 number1_int and number2_int together and print the result as an integer value.
Subtract number1_float from number2_float and print the result as a floating-point value.
Multiply number1_int by number1_float and print the result as an integer value.
Divide number1_int by number2_int and print the result as an integer and a floating-point value (Ask yourself: What happens when you divide an integer by an integer? Does the result change because you print it as a floating-point number?).
Divide number1_int by number2_float and print the result as an integer and a floating-point value (Ask yourself: How does this compare to the previous operations? We are now dealing with mixed data types).
Explicitly cast number1_int as a floating-point value and divide by number2_int. Print the result as a floating-point value.
Try to mod number1_float by number2_float. Does the program compile? If not, fix it so that it does.
Determine if number1_int and number2_int are even or odd. Print 0 if even and 1 if odd. You may not use if statements. Use the mod operator instead.
V. Part 2:
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^2)/ 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 third-order polynomial equation provided and determines the y value. Print the y value. The third-order polynomial equation is: y =3* a * x^3+(1/4)* b * x^2+10* c * x +(-5)* d (x, y, a, b, c, and d are integer numbers). Be careful here! What is (1/4) 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 =2* PI * radius (circumference and radius are floating-point numbers; PI should be defined as a constant floating-point number and should not be entered by the user).

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

Step: 3

blur-text-image

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

Beginning VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions

Question

2. Are you varying your pitch (to avoid being monotonous)?

Answered: 1 week ago

Question

3. Are you varying your speaking rate and volume?

Answered: 1 week ago