Question: 3 Formatted Input and Output Write a program that accepts four (4) lines of input: The first line contains a float value in 4.2f format

3 Formatted Input and Output

Write a program that accepts four (4) lines of input:

The first line contains a float value in 4.2f format

The second line contains a char value

The third line contains a 4-digit int value

The fourth line contains a char value

and then displays all of the input on a single line

Phone Number

Write a program that accepts a phone number of the form +1(xxx)-xxx-xxxx

where x is a digit, and displays the sum of all digits in the phone number.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Create a program called arithmetic.c that does the following:

Prompt for and accept an unsigned short int value

Display the value of 2 raised to the power of the value input in (1), i.e. display 2n, where n is the value from (1). HINT: Use math.h pow function, some casting would be needed.

Prompt for and accept an unsigned short int value, and assume that this is the radius of a circle

Display the values of the circumference and area of the circle whose radius is given by (3)

Prompt for and accept a float value

Display the value of the polynomial 2x3 + 3x2 + 4x + 5, where x is the value read in (5)

Prompt for and accept two int values. Display the remainder when the first integer is divided by the second using 1 single operation.

Your program must adhere to the class coding standards, and will be graded using the assignment grading criteria. Submit your source code file to the Desire2Learn dropbox for this assignment.

Some video examples:

1. Printf example

2. Operators (do not use the iostream.h library, use stdio.h instead)

Sample Output (prompts to the user)(green), sample input in blue

Program: Arithmetic Expressions Author: Doug Jones Enter unsigned short int: 3 The value of 2 raised to the 3 power is 8 Enter unsigned short int: 5 A circle with radius 5 has circumference of 31.416 and an area of 78.540 Enter a float value: 2.5 The value of 2(2.5)**3 + 3(2.5)**2 + 4(2.5) + 5 = 65

Enter two integers: 7 3

The remainder of 7 / 3 is 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!