MYPROGRAMMINGLAB WITH PEARSON ETEXT
MYPROGRAMMINGLAB WITH PEARSON ETEXT
8th Edition
ISBN: 9780134225340
Author: 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
Show the value of x after each of the statements is performed:                     x = fabs(-6.4);
Q4:What are the values of x and a after the following statements have been executed? a = 0; i = 1; x = 0; a = a + i; x = x +i/ a; a = a + i; x = x +i/ a; a = a + i; X = x +i/ a; a = a + i; x = x +i/ a; Q5: (a) Work out by hand the output of the following script for n=4: n = input( 'Number of terms? ); s = 0; for k = 1:n S = s+1/ (k *2); end; disp(sqrt(6 * s)) If you run this script for larger and larger values of n you will find that the output approaches a well-known limit. Can you figure out what it is? (b) Rewrite the script using vectors and array operations. 36 M.sc. Zena Ahmed 2016 MATLAB Section4 Q6:Work through the following script by hand. Draw up a table of the values of i, j and m to show how their values change while the script executes. Check your answers by running the script. v = [31 5]; i = 1; for j = v i=i+1; if i == 3 i=i+ 2; m = i+ j; end end
The value of x at the end.int x = 1;x = x + 1;x++;

Chapter 5 Solutions

MYPROGRAMMINGLAB WITH PEARSON ETEXT

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
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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY