Write a complete program that reads three num- bers adds


Problem 1: Arithmetic Operations?Fill in the blank. What is the value of k in the following statements using integer arithmetic. Problem 1. k = 3 + 9 % 5 - 6?        -------------

Problem 2. k = 7 / 6 + 7 % 6?        --------------

Problem 3. k = (7 / 6) * (9 % 7)     --------------

Problem 4. k = (11 + 6) < (7 * 3)      --------------

 Problem 5. k = ('5' - '1') + ('7' - '2')   ---------------

3 Program Statements-

In problems 16-20, show all additional variable names and types that you choose to use.

Problem 6. Write a statement that will convert x pounds to y grams (recall: 454 g = 1 lb).

Problem 7. Write two statements for calculating the circumference of a circle, given the radius (recall A = πr2 and π = 3.14).

Problem 8. Write a statement that will convert n inches to f feet (recall: 1 ft = 12 in).

Problem 9. Write a statement that can be used to calculate the volume of a sphere, given the radius V = 4/3πr3.

Problem 10. Write a statement that can be used to calculate the volume of a cylinder V = πr2h.

4 Program Analysis-?Fill in the blanks. Problem 22 refers back to problem

21.

Problem 13. charch = '3'; declares that ch is a variable.

Problem 14. long b = 3; declares that b is a variable. Problem 15. long m; m = 3.1*4;

cout<< "m: " << m; will write:

Problem 16. There are at least five errors in the program below. Circle five and only five of them. Each error is worth two points. // test1.cpp

#include

main() {

integer  j, k;

double   x, y;

cout<< "Enter two numbers: " cin>>x,y;?cout<< x << y;

/ /read values?cout<< "Enter two more numbers: "; cin>>k,j;?double a=x+y;?double b=k*j;?if( a => b )

cout<< "product is less than sum" <

else

cout<< "product is greater than sum";

return 0;

}

Problem 11. double x = 5; declares that x is a variable.

Problem 12. cout<< "k: " << x*5; will write:

Programs-

Problem 17. Write a program that converts a line of data containing three integers so that the data appears on three separate lines.

Problem 18. Write a complete program that reads three num- bers, adds 3.14 to each of them, and writes the result to the standard output stream if the result is greater than 10.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Write a complete program that reads three num- bers adds
Reference No:- TGS01041153

Now Priced at $30 (50% Discount)

Recommended (91%)

Rated (4.3/5)