C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 5, Problem 5.8E

Show the value of x after each of the following statements is performed:

  1. x = fabs ( 7 . 5 ) ;
  2. x = floor ( 7 . 5 ) ;
  3. x = fabs ( 0.0 ) ;
  4. x = ceil ( 0.0 ) ;
  5. x = fabs ( 6 . 4 ) ;
  6. x = ceil ( 6 . 4 ) ;
  7. x = ceil ( fabs ( +  floor ( 5 . 5 ) ) ) ;

a)

Expert Solution
Check Mark
Program Plan Intro

To show the value of x after the given statement is performed.

Program Description Answer

The value of x is 7 .

Explanation of Solution

Given information:

  x = fabs(7.5);

Explanation:

The fabs() is the function that calculates the absolute value of the argument written within it. The absolute value of the number is the magnitude of the number irrespective of the sign. The statement x = fabs(7.5) calculates the values and assigns it to x.

Hence, the value of x is 7

b)

Expert Solution
Check Mark
Program Plan Intro

To show the value of x after the given statement is performed.

Program Description Answer

The value of x is 7 .

Explanation of Solution

Given information:

  x = floor(7.5);

Explanation:

The floor() is the function that calculates the value of the largest integer less than or equal to the argument written within it.

The statement x = floor(7.5); calculates the values and assigns it to x.

The largest integer less than or equal to 7.5 is 7.

Hence, the value of x is 7

c)

Expert Solution
Check Mark
Program Plan Intro

To show the value of x after the given statement is performed.

Program Description Answer

The value of x is 0 .

Explanation of Solution

Given information:

  x = fabs(0.0);

Explanation:

The fabs() is the function that calculates the absolute value of the argument written within it. The absolute value of the number is the magnitude of the number irrespective of the sign. The statement x = fabs(0.0); calculates the values and assigns it to x.

Hence, the value of x is 0

d)

Expert Solution
Check Mark
Program Plan Intro

To show the value of x after the given statement is performed.

Program Description Answer

The value of x is 0 .

Explanation of Solution

Given information:

  x = ceil(0.0);

Explanation:

The ceil() is the function that calculates the value of the smallest integer greater than or equal to the argument number written within it.

The statement x = ceil(0.0); calculates the values and assigns it to x.

The smallest integer greater than or equal to 0.0 is 0.

Hence, the value of x is 0

Expert Solution
Check Mark
Program Plan Intro

To show the value of x after the given statement is performed.

Program Description Answer

The value of x is 6 .

Explanation of Solution

Given information:

  x = fabs(6.4);

Explanation:

The fabs() is the function that calculates the absolute value of the argument written within it. The absolute value of the number is the magnitude of the number irrespective of the sign. The statement x = fabs(6.4); calculates the values and assigns it to x.

Hence, the value of x is 6

e)

Expert Solution
Check Mark
Program Plan Intro

To show the value of x after given statement is performed.

Program Description Answer

The value of x is 6 .

Explanation of Solution

Given information:

  x = ceil(6.4);

Explanation:

The ceil() is the function that calculates the value of the smallest integer greater than or equal to the argument number written within it.

The statement x = ceil(6.4); it calculates the values and assigns it to x.

The smallest integer greater than or equal to -6.4 is -6.

Hence, the value of x is 6

f)

Expert Solution
Check Mark
Program Plan Intro

To show the value of x after the given statement is performed.

Program Description Answer

The value of x is 14 .

Explanation of Solution

Given information:

  x = ceil(fabs(8+floor(5.5)));

Explanation:

The statement includes fabs() , ceil() and floor() functions.

The ceil() is the function that calculates the value of the smallest integer greater than or equal to the argument number written within it.

The fabs() is the function that calculates the absolute value of the argument written within it. The absolute value of the number is the magnitude of the number irrespective of the sign.

The floor() is the function that calculates the value of the largest integer less than or equal to the argument written within it.

On the basis of the above definitions solving the given statement as follows-

  x = ceil(fabs(8+floor(5.5)));x = ceil(fabs(86));x = ceil(fabs(14));x = ceil(14);x=14

Hence, the value of x is 14

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!
04:54
Students have asked these similar questions
When the FCC added Color Television to the Industry Standards, they went with the system developed in the 1940s by Peter Goldman for CBS.   Question 15 options:   True   False Part of the reason that many critics disliked 1950s gameshows was the fact that gameshows offered one of the few opportunities to see unscripted interactions with "real" (average/non-famous) people on television.   Question 16 options:   True   False The Andy Griffith Show is an example of the "rural revival" shows that become enormously popular on 1960s American television.   Question 19 options:   True   False During the Network Era, the hours before primetime each day were exclusively devoted to locally-produced programming, not programming dictated by an affiliate station's parent network.   Question 20 options:   True   False
Although color television was not added to the industry standard until 1956, CBS had been broadcasting selected special events in color as early as 1950.   Question 1 options:   True   False Two key factors in creating the Network Era of American television were the FCC licensing freeze and ______________.   Question 4 options:   The Quiz Show Scandals   Habitual Viewing   Operation Frontal Lobes   Drop-In Viewing Least Objectionable Programming was designed to embrace the public service-oriented vision of using television to elevate mass culture and enrich viewers.   Question 6 options:   True   False By the end of the 1950s, all three remaining networks (NBC, CBS, & ABC) were broadcasting their entire nightly programming schedule in full color.   Question 9 options:   True   False
7. See the code below and solve the following. public class Test { public static void main(String[] args) { int result = 0; } result = fn(2,3); System.out.println("The result is: + result); // fn(x, 1) = x // fn(x, y) = fn(x, y-1) + 2, when y>1 public static int fn(int x, int y) { if (x <= 1) return x; else return fn(x, y-1) + 2; } } 7-1. This program has a bug that leads to infinite recursion. Modify fn(int x, int y) method to fix the problem. (2 point) 7-2. Manually trace the recursive call, fn(2,3) and show the output (step by step). (2 point) 7-3. Can you identify the Base Case in recursive method fn(int x, int y)? (1 point)

Chapter 5 Solutions

C How to Program (8th Edition)

Ch. 5 - Prob. 5.19ECh. 5 - (Displaying a Square of Any Character) Modify the...Ch. 5 - Prob. 5.21ECh. 5 - (Separating Digits) Write program segments that...Ch. 5 - (Time in Seconds) Write a function that takes the...Ch. 5 - (Temperature Conversions) Implement the following...Ch. 5 - (Find the Minimum) Write a function that returns...Ch. 5 - (Perfect Numbers) An integer number is said to be...Ch. 5 - Prob. 5.27ECh. 5 - (Reversing Digits) Write a function that takes an...Ch. 5 - (Greatest Common Divisor) The greatest common...Ch. 5 - (Quality Points for Students Grades) Write a...Ch. 5 - (Coin Tossing) Write a program that simulates coin...Ch. 5 - (Guess the Number) Write a C program that plays...Ch. 5 - (Guess the Number Modification) Modify the program...Ch. 5 - (Recursive Exponentiation) Write a recursive...Ch. 5 - (Fibonacci) The Fibonacci series 0, 1, 1, 2, 3, 5,...Ch. 5 - (Towers of Hanoi) Every budding computer scientist...Ch. 5 - Prob. 5.37ECh. 5 - Prob. 5.38ECh. 5 - Prob. 5.39ECh. 5 - Prob. 5.40ECh. 5 - (Distance Between Points) Write a function...Ch. 5 - Prob. 5.42ECh. 5 - Prob. 5.43ECh. 5 - After you determine what the program of Exercise...Ch. 5 - (Testing Math Library Functions) Write a program...Ch. 5 - Find the error in each of the following program...Ch. 5 - Prob. 5.47ECh. 5 - (Research Project: 1m proving the Recursive...Ch. 5 - (Global Warming Facts Quiz) The controversial...Ch. 5 - Prob. 5.50MDCh. 5 - Prob. 5.51MDCh. 5 - (Computer-Assisted Instruction: Monitoring Student...Ch. 5 - (Computer-Assisted Instruction: Difficulty Levels)...Ch. 5 - (Computer-Assisted Instruction: Varying the Types...

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
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
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY