Programming in C
Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 5, Problem 1E

Type in and run the 12 programs presented in this chapter. Compare the output produced by each program with the output presented after each program in the text. Try experimenting with each program by keying in values other than those shown.

Expert Solution & Answer
Check Mark

Explanation of Solution

Program 5.1:

Purpose of the program:

  • The purpose of the program is to calculate the absolute value of an integer.
  • The program uses the “if” statement to check the number is greater than “0” and displays the absolute value of the result.
Sample Output

Type in your number: -100

The absolute value is 100

Comparison:

The program “5.1” runs successfully and produces the output as it is given in the text book.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
Study the given program and the sample output.  Provide the missing code for all items.
Select the suitable answer:1.1 If a do...while structure is used:a. An infinite loop cannot take place.b. Counter-controlled iteration is not possible.c. The body of the loop will execute at least once.d. An off-by-one error cannot occur.
For each of the programs below, in the blank in the code below so that it prints out "decode". If  this is not possible instead write "Not Possible
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Introduction to Operators in C; Author: Neso Academy;https://www.youtube.com/watch?v=50Pb27JoUrw;License: Standard YouTube License, CC-BY