EBK C HOW TO PROGRAM
EBK C HOW TO PROGRAM
8th Edition
ISBN: 9780100663831
Author: Deitel
Publisher: YUZU
bartleby

Videos

Textbook Question
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
The below expression is used to determine whether or not the given year is a leap year. Add the appropriate parenthesis to make the expression more readable (assuming that you have a junior developer in your development team who is still learning how to program in Java efficiently). What is the output of the Boolean variable "isLeapYear"? int year = 2020; boolean isLeapYear = year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
In Java, Determine if the statement has valid syntax or not. If not, fix the syntax error. double x^y;  double  amount%; double Double y=9.5;
Ask the user for a name and for a list of test scores. Show the number of tests taken and the average. Allow the user to enter any number of scores and make the program end when a negative value is entered. Write in java and use test case examples as a result.

Chapter 5 Solutions

EBK C HOW TO PROGRAM

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