CSCE106 Lab Session 3
CSCE106 Lab Session 3
Objectives:
Problems:
Draw a Flow Chart and Write a C++ program to solve each of the following problems:
1. Given a, b, and c, compute and display R1 and R2 (rounded to the nearest hundredth) according to
the following formulas:
(hint: To test your solution; choose input values such that a not equal to zero and b2 – 4ac not
negative)
2. Given a positive number, print its square and square root rounded to the nearest tenth.
3. Given the depth (in kilometers) inside the earth; compute and display the temperature at that depth
in degrees Celsius and Fahrenheit. The relevant formulas are:
4. The Pythagorean Theorem states that the sum of the squares of the sides of a right triangle is equal
to the square of the hypotenuse. For example, if two sides of a right triangle have lengths 3 and 4,
then the hypotenuse must have a length of 5. The integers 3, 4, and 5 together form a Pythagorean
triple. There is an infinite number of such triples. Given two positive integers, m and n, where m > n,
a Pythagorean triple can be generated by the following formulas.
Side1 = m2- n2
Side2 = 2mn
Hypotenuse = √𝑺𝒊𝒅𝒆𝟏𝟐 + 𝑺𝒊𝒅𝒆𝟐𝟐
Write a program that reads in values for m and n and prints the values of the Pythagorean triple
generated by the formulas above.
Instructions: