Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

on c program PART I: PROGRAMMING EXERCISES Exercise #1: a. Using Geany, write a C program that asks the user for four (4) integer numbers

image text in transcribedon c program

PART I: PROGRAMMING EXERCISES Exercise #1: a. Using Geany, write a C program that asks the user for four (4) integer numbers and put those into 4 integer variables. Always use a prompt to help guide the user. You can ask for all 4 numbers at once (like 'Enter 4 numbers:') or one by one. b. Next, have your program produce and output the sum of those four numbers. Be sure the output has a label which tells the user what the output value represents. (eg: Sum of the four values is: 23). c. Next have your program output the sum of the first two numbers minus the sum of the last two. d. Next have your program produce and output the sum of the squares of the four numbers. e. Next have your program produce and output the exact quotient (a real number with a decimal point - a double) of the square root of the sum of the squares of the numbers, divided by the sum of all the numbers. eg for input values 3 4 5 6 this is 0.51 [square root of (9+16+25+36) divided by 18). Show the output with two decimal digits of accuracy. Are you sure you got your answer right? Try with a calculator and compare with your C program. Exercise #2: a. Using Geany, write a C program that creates a table of distance equivalents in yards and miles for 100m, 200m, 400m, and 800m. You would input each value into a variable and then convert it first to yards and then to miles by multiplying it by the appropriate conversion factor. A meter is equivalent to 1.094 yards and 0.0006215 miles. Your program should right justify all the numbers (see your printf notes from the lectures), aligning them nicely in a column (table) form. Exercise #3: a. Using Geany, write a C program that calculates the volume of a sphere. Look for the formula on the Internet and ask the user for the required inputs (prompt the user clearly and label the output). Exercise #4: a. Write and run in Geany a C program to find the third angle of a triangle if two angles are given. No clue? Find the formula on the Internet. Exercise #5: a. Using Geany, write a C program to compute the sum of the two given integer values (ask the user for them). If the two values are the same, display the triple of their sum. If they are not the same, just display the sum. Exercise #6: a. Using Geany, write a C program that asks the user for 3 integer numbers then displays these 3 numbers in descending order. Assume all 3 numbers are different. PART II: DISCOVERY ACTIVITIES i. Can you explain why 3+5+8 divided by 3 doesn't give the correct average of the numbers 3, 5, and 8? ii. Using your text book, or an Internet search (do not ask friends or TA) or simply by experimenting with Geany, explain in a few sentences the differences between the division (/) and the remainder (%) operators

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

Databases Theory And Applications 27th Australasian Database Conference Adc 20 Sydney Nsw September 28 29 20 Proceedings Lncs 9877

Authors: Muhammad Aamir Cheema ,Wenjie Zhang ,Lijun Chang

1st Edition

3319469215, 978-3319469218

More Books

Students also viewed these Databases questions