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
1. Complete the routing table for R2 as per the table shown below when implementing RIP routing Protocol? (14 marks) 195.2.4.0 130.10.0.0 195.2.4.1 m1 130.10.0.2 mo R2 R3 130.10.0.1 195.2.5.1 195.2.5.0 195.2.5.2 195.2.6.1 195.2.6.0 m2 130.11.0.0 130.11.0.2 205.5.5.0 205.5.5.1 R4 130.11.0.1 205.5.6.1 205.5.6.0
Analyze the charts and introduce each charts by describing each. Identify the patterns in the given data. And determine how are the data points are related.   Refer to the raw data (table):
3A) Generate a hash table for the following values: 11, 9, 6, 28, 19, 46, 34, 14. Assume the table size is 9 and the primary hash function is h(k) = k % 9. i) Hash table using quadratic probing ii) Hash table with a secondary hash function of h2(k) = 7- (k%7) 3B) Demonstrate with a suitable example, any three possible ways to remove the keys and yet maintaining the properties of a B-Tree. 3C) Differentiate between Greedy and Dynamic Programming.

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