Question: Program 1 Write a C program to calculate the volume of a cylinder, as follows: 1. The code uses the standard formula, V = p
Program 1
Write a C program to calculate the volume of a cylinder, as follows: 1. The code uses the standard formula, V = p r2h where r is the radius and h is the height. Also, you may use 3.14159 for the value of PI 2. The program asks the user to enter the radius and height of the cylinder and stores them into an appropriate data type. 3. The program uses floating point math and displays the result with two decimal digits of precision. A sample execution is shown below: Enter radius: 10.5 Enter height: 3 Volume: 1039.08 4. Name your program volume_of_cylinder.c Hints: Because C does not have an exponentiation operator, you will need to multiply r by itself twice to compute r2 For the value of p you should define a constant; however, this value can be hardcoded to 3.14159.
Program 2
Using the tax rates table provided below. Write a C program named calculate_tax_amount.c that does the following: 1. Asks the user to enter their income. You may assume that the user enters an integer value. 2. Calculates their tax due based on the table. The result must be a floating-point number. 3. Displays the tax amount, also a floating-point number. Format the output to two (2) decimal places. 4. Asks the user for the number of dependents. You may assume that the user enters an integer value. The user will enter zero if the answer is none. 5. Calculates and displays a tax credit of $450 per dependent, up to five dependents, i.e., the maximum credit is $2,250. 6. Displays the adjusted tax amount (tax minus credit). Format the output to two (2) decimal places. Tax Rate Income Bracket 12% $0 to $9,275 17% $9,275 to $37,650 27% $37,650 to $91,150 30% $91,150 to $190,150 35% $190,150 and above A few sample runs are provided below: Enter income: 9200 Tax due = $1104.00 Enter the number of dependents (0 for none): 0 Tax credit = $0 Adjusted Tax = $1104.00 Enter income: 20000 Tax due = $3400.00 Enter the number of dependents (0 for none): 2 Tax credit = $900 Adjusted Tax = $2500.00 Enter income: 191025 Tax due = $66858.75 Enter the number of dependents (0 for none): 9 Tax credit = $2250 Adjusted Tax = $64608.75
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
