[Solved] SOLVED: Chapter 3 Solutions to exercises from the book C Primer Plus by Stephen Prata

30 $

File Name: SOLVED:_Chapter_3_Solutions_to_exercises_from_the_book_C_Primer_Plus_by_Stephen_Prata.zip
File Size: 800.7 KB

SKU: [Solved] SOLVED: Chapter 3 Solutions to exercises from the book C Primer Plus by Stephen Prata Category: Tag:

Or Upload Your Assignment Here:


Exercise1.

Find out what your system does with integer overflow, floating-point overflow,and floating point underflow by using the experimental approach; that is,write programs that have these problems.

Exercise 2:Write a program that asks you to enter an ASCII code value, such as 66, andthen prints the character having that ASCII code.

Exercise 3:Write a program that sounds an alert and then prints the following text: Startled by the sudden sound, Sally shouted,“By the Great Pumpkin, what was that!”

Exercise 4:Write a program that reads in a floating-point number and prints it first in decimal-point notation, then in exponential notation, and then, if your system supports it, p notation. Have the output use the following format (the actual number of digits displayed for the exponent depends on the system):

Enter a floating-point value: 64.25fixed-point notation: 64.250000exponential notation: 6.425000e+01p notation: 0x1.01p+6

Exercise 5

There are approximately 3.156 × 10^7 seconds in a year. Write a program that requests your age in years and then displays the equivalent number of seconds.

Exercise 6:

The mass of a single molecule of water is about 3.0×10^-23 grams. A quart ofwater is about 950 grams. Write a program that requests an amount of water,in quarts, and displays the number of water molecules in that amount.

Exercise 7:

There are 2.54 centimeters to the inch. Write a program that asks you to enteryour height in inches and then displays your height in centimeters. Or, if youprefer, ask for the height in centimeters and convert that to inches.

Exercise 8:

In the U.S. system of volume measurements, a pint is 2 cups, a cup is 8 ounces,an ounce is 2 tablespoons, and a tablespoon is 3 teaspoons. Write a programthat requests a volume in cups and that displays the equivalent volumes inpints, ounces, tablespoons, and teaspoons. Why does a floating-point type makemore sense for this application than an integer type?

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED: Chapter 3 Solutions to exercises from the book C Primer Plus by Stephen Prata
30 $