Question

In: Computer Science

Give the value of x (x is an integer and assume integer arithmetic for all operations)....

Give the value of x (x is an integer and assume integer arithmetic for all operations).

________ 1.             x = 12 - 4 * 2 - 8;

________ 2.             x = 24 / 2 + 1 * 4;

________ 3.             x = 12 - 9 + 4 * 2 + 3 ^ 4;

________ 4.             x = 24/(3 + 2) * 4;

________ 5.             x = 2 * (5 - 3) + 7;

________ 6.             x = 12 - (15/5 - 2) * 5;

________ 7.             x = 20 - 15/((5 - 2) * 5);

________ 8.             x = 13 % 5;

Evaluate the following equations, given A = 12, B = 3, C = 6, D = 2 ,A, B, C, and D are integers, and all operations are integer

________ 9.             x = A + B/C - D^2.;

________ 10.         x = A + B/(C - D^2);

________ 11.         x = (A + B) % C;

________ 12.         x = (A + B)/C - D^2;

Assume the following order of operations:

!

&&

||

Give the value of x,

given A = FALSE, B = FALSE, C = FALSE, D = TRUE. E = 10, F = 15

________ 13.         x = A && B

________ 14.         x = C || D

________ 15.         x = !C

________ 16.         x = !(A && D)

________ 17.         x = !C && B

________ 18.         x = ( E < 10) && (E == F)

________ 19.         x = A && B || C && D

________ 20.         x = !(A && B) || !(D && C)

Write c++ statements for each of the following (no declarations necessary here):

  1. Output a message that says "Hello everybody"  

                                                                                   

  1. Prompt the user to enter a name.                      
  1. Input a name into a variable.    
                             
  2. Output Hello and the name you input.  
  3. Prompt for two numbers.                                 
  1. Input two numbers.           

                                   
  2. Compute the sum of the two numbers.  
  3. Output "the sum is" followed by the sum.   
           
  4. Modify the previous statement to echo print the two numbers entered. " the sum of x and y is z"; Do not use x, y, z use variables from above.

  1. Input the price of an item.             
                        
  2. Calculate the sales tax.                         
  1. Compute the total price, given price and sales tax.
  1. Compute the average of three test scores.     
      

Solutions

Expert Solution


Related Solutions

using python without external libaries Using integer arithmetic operators '+' and '-', print all combinations that...
using python without external libaries Using integer arithmetic operators '+' and '-', print all combinations that sum up to 'sum' by inserting the operators between digits in 'number'. example for 'number=123456789' and 'sum = 0' Print the output using the terminal: Output should be exactly like this from 1 - 22 1 : +1+2-34-56+78+9=0 2 : +1-2-34+5+6+7+8+9=0 3 : +1-23-4-56-7+89=0 ... 12 : -1+2+34-5-6-7-8-9=0 13 : -1+23+4+56+7-89=0 14 : -1-2+34+56-78-9=0 ... 22 : -12-34+56+7-8-9=0
Design and implement an application that reads an integer value and prints the sum of all...
Design and implement an application that reads an integer value and prints the sum of all even integers between 2 and the input value, inclusive. Print an error message if the input value is less than 2 and prompt accordingly so that the user can enter the right number. Your program file will be called YourLastNameExamQ2
x, y, z, w, u and t are integer variables, what will their value be after...
x, y, z, w, u and t are integer variables, what will their value be after the execution of the statements below. Give the final value of each variable x = 7; y = x + 1; z = x % (y – 2) + 4; y = (y + z ) % (x + 4) ; w = (x * y) / (z – 3); x = x + x; u = w - 3; t = z +...
C++ OOP Make a program to evaluate infix arithmetic expressions containing integer operands and the operators...
C++ OOP Make a program to evaluate infix arithmetic expressions containing integer operands and the operators + (addition), - (subtraction), * (multiplication), / (division) and pairs of parentheses, properly nested. Use the following two-stack algorithm (by E. W. Dijkstra): If the next token in the expression is an integer, push the integer onto the value stack. If the next token in the expression is an operator, If the operator stack is empty or the priority of the operator is greater...
Suppose x,y ∈ R and assume that x < y. Show that for all z ∈...
Suppose x,y ∈ R and assume that x < y. Show that for all z ∈ (x,y), there exists α ∈ (0,1) so that αx+(1−α)y = z. Now, also prove that a set X ⊆ R is convex if and only if the set X satisfies the property that for all x,y ∈ X, with x < y, for all z ∈ (x,y), z ∈ X.
Java program - you are not allowed to use arithmetic operations such as division (/), multiplication,...
Java program - you are not allowed to use arithmetic operations such as division (/), multiplication, or modulo (%) to extract the bits. In this exercise use only logic bit-wise operations. Write a program that prompts the user to enter a positive integer n (0 up to 232 -1). You must write a function that takes as input n and returns a string s representing the number n in binary. For this assignment, you CANNOT use the arithmetic division by...
Find the coordinates of all local extrema and inflections of y = x − 4√x. Give...
Find the coordinates of all local extrema and inflections of y = x − 4√x. Give the intervals where the function is increasing, decreasing, concave up, and concave down.
1. Assume X ∼ N(20, 25), (a) find P(X > 25) (b) the value of x...
1. Assume X ∼ N(20, 25), (a) find P(X > 25) (b) the value of x if P(X > x) = 0.975. (c) find the values of a and b, two symmetrical values about 20 such that P(a < X < b) = 0.95. (d) If X1, X2, . . . , X100 is random sample for the distribution of X • what is the sampling distribution of the sample mean X¯? • find P(X >¯ 20.50) (e) Suppose the...
using 8 bits and 2s complement integer arithmetic, show how a processor would calculate 63 -...
using 8 bits and 2s complement integer arithmetic, show how a processor would calculate 63 - 17
Fraction calculator: Write a program that lets the user perform arithmetic operations on fractions.
Fraction calculator: Write a program that lets the user perform arithmetic operations on fractions. Fractions are of the form a / b, in which a and b are integers and b != 0.Your program must:be menu driven, allowing the user to select the operation (+, -, *, or /) and input the numerator and denominator of each fraction.The input must be validated for correct operation (+, -, *, or /) and b != 0. If any of these cases are...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT