Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

Describe computer-aided dispatch technology

Answered: 1 week ago

Question

Understand the concept and implementation of a confusion matrix

Answered: 1 week ago