a.
Explanation of Solution
Given: The values of the variables, x = 2, y = 3, and z = 1, are assigned to the expression, x+2 / 6+y.
To find: The result of the expression, x+2 / 6+y, if x = 2, y = 3, and z = 1 .
Solution:
Precedence of the operator defines the grouping of words within an expression and defines how to interpret an expression. Many operators precede over others; for example, the operator of multiplication has a greater precedence than the operator of addition...
b.
Explanation of Solution
Given: The values of the variables, x = 2, y = 3, and z = 1, are assigned to the expression, y-3 * z+2.
To find: The result of the expression, y-3 * z+2, if x = 2, y = 3, and z = 1 .
Solution:
Precedence of the operator defines the grouping of words within an expression and defines how to interpret an expression. Many operators precede over others; for example, the operator of multiplication has a greater precedence than the operator of addition...
c.
Explanation of Solution
Given: The values of the variables, x = 2, y = 3, and z = 1, are assigned to the expression, z – (x+z) % 2 + 4.
To find: The result of the expression, z – (x+z) % 2 + 4, if x = 2, y = 3, and z = 1 .
Solution:
Precedence of the operator defines the grouping of words within an expression and defines how to interpret an expression. Many operators precede over others; for example, the operator of multiplication has a greater precedence than the operator of addition...
d.
Explanation of Solution
Given: The values of the variables, x = 2, y = 3, and z = 1, are assigned to the expression, x-2*(3+z)+y.
To find: The result of the expression, x-2*(3+z)+y, if x = 2, y = 3, and z = 1 .
Solution:
Precedence of the operator defines the grouping of words within an expression and defines how to interpret an expression. Many operators precede over others; for example, the operator of multiplication has a greater precedence than the operator of addition...
e.
Explanation of Solution
Given: The values of the variables, x = 2, y = 3, and z = 1, are assigned to the expression, y++ + z-- + x++.
To find: The result of the expression, y++ + z-- + x++, if x = 2, y = 3, and z = 1 .
Solution:
Prefix operation like ‘++var’ or ‘--var', having property that the value is first incremented or decremented by 1, then it returns the value...
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
- Question: Party budget planning - complex Prompt the user to enter their current budget and the number of people who need to share a meal. You are ordering food from a restaurant that has two menu items: Tacos $4 Empanadas $3 Calculate and print out all the options of meals where the budget is used entirely(where possible) and each person has an equal number of items to eat. They may eat different things, but everyone gets the same number of food items, e.g. 2 tacos or 1 empanada and 1 taco or 2 empanadas. Hints: Here are some things that might help you in your solution. If total items purchased does not equally divide by the number of diners, then abandon that combination. It may help to calculate the max number of empanadas that the budget can buy and also the max number of tacos that the budget could buy. These can be thought of as upper bounds in your loops. In your solution, keep track of items per person Also, keep track of total number of viable solutions, as that might…arrow_forwardEvaluate the following expressions, assume the following declarations: int x = 4 /3 * 2; int y = 9/ 2; int num = 6; num *= x + y; What is the value of the num after expression is evaluated?arrow_forwardx = 9 ; y = x++ What are the values of x and y after the two statements execute? X = y =arrow_forward
- Given the following declaration: int x; int* p; Which of the following expressions is allowed? Select one: a. p = x; b. p = &x; %3D C. p = *x; d. x = p;arrow_forwardUsing C++, write a program for a "6/15 Lottery Game". Please take note of the following: 1. It must only request the user to enter a digit between 0 and 15, six times. It must be specified in the output display that it is "1st digit", "2nd digit", and so on up to "6th digit". 2. If the digit entered is more than 15, the application will notify the player by displaying the following message: "Error! Please only enter digits between 0 and 15! Repeat your choice!" And the program will be terminated. 3. If at least one digit from the Lottery draw matched (precise array position and digit), the output display must be, for example: "1 Match! Your bet is now available for the next draw!" 4. If no digit from the Lottery draw matched, the output display must be, for example: "No Exact Match Found; Please Retry!" 5. Note that repetition of input digit chosen by the player is allowed. 6. And finally, if all digit matches, it will give an output display, as an example: "Congratulations!"arrow_forwardWhat is the value of the following expression: 9 * 2 - 8 > 5 + 2 / 2? a. False b. 10 c. True d. 6arrow_forward
- Write a main function that performs the following: • Prompts user to enter 2 values A and B. . If the first number A is less than the second number B, the main function should print the sum of all numbers multiple of 2 from 1 to A. • If the first number A is greater than the second number B, the main function should print the product of all numbers multiple of 4 from 1 to B. • If not, the main function should display "Wrong data. Try again!".arrow_forwardWhat is the value of the expression 10 + t1%t2*5/(t3-1)? Assume that, int t1=17, t2=3, t3=7;arrow_forwardPrint "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 4 if userNum2 is greater than 9. Otherwise, print "userNum2 is less than or equal to 9.". End with newline. C codearrow_forward
- In C++, write a program that converts a temperature from degrees Fahrenheit to degrees Celsius. The formula for converting the temperature from Fahrenheit to Celsius is: celsius = (5/9) (fahrenheit - 32). The program should prompt the user to enter a temperature in Fahrenheit as an integer. It will output the temperature in both Fahrenheit and Celsius. Round decimal values to 4 decimal places.arrow_forwardWhat will be assigned to x in each of the following statements? x = 8 + 3; x = 8 - 3; x = 8 * 3; x = 8 % 3;arrow_forwardEvaluate each of the following expressions. Assume the following: int a = 3, b = 7; float x = 6.0, y = 3.1 z = 2.0 (int)y * 10 + barrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT