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
Write a C program that reads an integer value. Assume it is the number of a...
Write a C program that reads an integer value. Assume it is the number of a month of the year; print out the name of that month (Hint: months need to be captured in an array).
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
Write a C++ arithmetic calculator program that performs four arithmetic operations namely addition, subtraction, multiplication and...
Write a C++ arithmetic calculator program that performs four arithmetic operations namely addition, subtraction, multiplication and division. This program prompts user to enter data in the following order: First data is the number, second data is an operator and the third data is the number. You are required to: Write a function for addition. Write a function for subtraction. Write a function for multiplication. Write a function for division. Write a main program which calls four functions based on the...
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 +...
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.
1. All questions assume the alphabet Σ = { a , b }. a) Give a...
1. All questions assume the alphabet Σ = { a , b }. a) Give a regular expression representing the language of all strings containing abab as a substring. b) Give a regular expression representing the language of all strings with an even number of a's or an odd number of b's, such as abab or baabaab. c) Give a regular expression representing the language of all strings of the form ambn, where m is even and n is odd....
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...
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...
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.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT