Concept explainers
Assume the variables result, w, x, y, and z are all integers, and that w = 5, x = 4, y = 8, and z = 2. What value will be stored in result after each of the following statements execute?
a. result = x + y
b. result = z * 2
c. result = y / x
d. result = y – z
e. result = w / / z
Learn your wayIncludes step-by-step video
Chapter 2 Solutions
Starting Out with Python plus MyProgrammingLab with Pearson eText -- Access Card Package (3rd Edition)
Additional Engineering Textbook Solutions
Introduction To Programming Using Visual Basic (11th Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Starting out with Visual C# (4th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Concepts Of Programming Languages
Modern Database Management (12th Edition)
- If int x = 10;, int y = 7;, double z = 4.5;, and double w = 2.5;, evaluate each of the following statements, if possible. If it is not possible, state the reason. (3, 4) (x + y) % x x % y + w (z - y) / w (y + z) % x (x % y) * z x % y % 2 (x + y) % z (x % y + z) / warrow_forwarda. Write a program named CheckMonth that prompts a user to enter a birth month. If the value entered is greater than 12 or less than 1, display an error message; otherwise, display the valid month with a message such as 3 is a valid month. b. Write a program named CheckM0nth2 that prompts a user to enter a birth month and day. Display an error message if the month is invalid (not I through 12) or the day is invalid for the month (for example, not between 1 and 31 for January or between I and 29 for February). If the month and day are valid, display them with a message.arrow_forwardWrite TRUE if the truth value of the statement is incorrect, otherwise write FALSE.arrow_forward
- Fahrenheit to Celsius using multiple statements Given a Fahrenheit value temperatureFahrenheit, write a statement that assigns temperatureCelsius with the equivalent Celsius value. While the equation is C = 5/9 * (F - 32), as an exercise use two statements, the first of which is "fractionalMultiplier = 5/9:". Check if varlables temperatureFahrenheit, fractionalMultiplier, and temperatureCelsius exist Variable temperatureCelsius does not exist. From Matlabarrow_forwardTRUE OR FALSE. Write TRUE if the statement is true, otherwise, writeFALSE.If P and Q are true statements and R is a false statement, then the statement (P ∧ Q) ∨ R ⇒ (¬Q) is true.arrow_forwardAssume integers x = 4, y = 7, and z = 2. What value will be stored in integervariab le resul t by each of the following statements?A) resul t = x + y;B) result = y * 2;C) resul t = y I z ;arrow_forward
- Write two cin statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a dash, and the year. End with newline. Remember that outputting 'endl' outputs a newline.Ex: If the input is 1 2000, the output is:1-2000 #include <iostream>using namespace std; int main() { int birthMonth; int birthYear; /* Your solution goes here */ return 0;}arrow_forwardAssume w = 5, x = 4, y = 8, and z = 2. What value will be stored in result in each ofthe following statements?A) result = x + y;B) result = z * 2;C) result = y / x;D) result = y − z;E) result = w % 2;arrow_forward(Financials: currency exchange) Write a program that prompts the user to enter the exchange rate from currency in U.S. dollars to Rupees PKR. Prompt the user to enter 0 to convert from U.S. dollars to Rupees PKR and 1 to convert from Rupees PKR and U.S. dollars. Prompt the user to enter the amount in U.S. dollars or Rupees PKR to convert it to Rupees PKR or U.S. dollars, respectively. Use c++ program.arrow_forward
- Suppose that height is a double variable, ch is a char variable, and name is a string variable. What are the values of height and name after the following input statements execute: cin >> height;cin.get(ch);getline(cin, name);if the input is:a. 5.4 Christy Millerb. 5.4Christy Millerarrow_forwardAssuming the following code: int x = myfunction1(); /* arbitrary value */ int y = myfunction2(); /* arbitrary value */ int z = myfunction3(); /* arbitrary value */ //convert to double double dx = (double) x; double dy = (double) y; double dz = (double) z; unsigned ux = x; unsigned uy = y; The following statement always evaluates to 1 (True or False): (dx + dy) + dz == dx + (dy + dz) True Falsearrow_forwardDetermine whether the statement are TRUE or FALSE. Write TRUE if the Statement is True and False otherwise.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,