Question: Hello, I would like help answering this Java question. I am suppose to answer using if - else Statements as a beginner. Please explain in
Hello, I would like help answering this Java question. I am suppose to answer using if - else Statements as a beginner. Please explain in detail what you do.
Here is the question:
Write a program that asks the user to input three int values, a, b, and c. The goal of this program is to output the sum of the input values. However, there is one rule:
- If one of the values is a 13, then this value will not count towards the final sum and all the values to its right will not count. For example: if b is a 13 then both b and c do not count. And, if a is a 13, then a, b, and c do not count.
Execution 1:
- Input integer 1: 2 Input integer 2: 3 Input integer 3: 1 Result: 6
Execution 2:
- Input integer 1: 5 Input integer 2: 13 Input integer 3: 2 Result: 5
Execution 3:
- Input integer 1: 13 Input integer 2: 7 Input integer 3: 2 Result: 0
Execution 4:
- Input integer 1: 7 Input integer 2: 5 Input integer 3: 13 Result: 12
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
