Programming Exercises

  1. 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 having these problems.

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

  3. Write a program that sounds the alert and then prints the following text:

    Startled by the sudden sound, Sally shouted, "By the Great Pumpkin,
    what was that!"
    
  4. Write a program that reads in a floating-point number and prints it first in decimal-point notation and then in exponential notation. Have the output use the following format:

    The input is 21.290000 or 2.129000e+001.
    
  5. There are approximately 3.156 × 107 seconds ...

Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.