Ask the user to enter 2 integers the second one being non-zero. Store these 2 values in int objects named a and b respectively. Use if/else selection statement to da the following: In the case the b is not zero: • compute the integer quotient of a/b and integer remainder a%b • store them into q and r. • output these values. In the case that b is zero: • output the message "Division by zero is undefined!" Sample output 1: Enter 2 integers (the second being non-zero): 15 6 q = 15 / 6 = 2 r = 15 % 6 = 3 Sample output 2: Enter 2 integers (the second being non-zero): 15 0 Division by zero is undefined!

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question
Ask the user to enter 2 integers the second one being non-zero. Store these 2 values in int objects named a and b respectively. Use if/else selection statement to do
the following: In the case the b is not zero:
• compute the integer quotient of a/b and integer remainder a%b
store them into q and r.
• output these values.
In the case that b is zero:
• output the message "Division by zero is undefined!"
Sample output 1:
Enter 2 integers (the second being non-zero): 15 6
15 / 6
2
%3D
r
15 % 6
3
Sample output 2:
Enter 2 integers (the second being non-zero): 15 0
Division by zero is undefined!
Transcribed Image Text:Ask the user to enter 2 integers the second one being non-zero. Store these 2 values in int objects named a and b respectively. Use if/else selection statement to do the following: In the case the b is not zero: • compute the integer quotient of a/b and integer remainder a%b store them into q and r. • output these values. In the case that b is zero: • output the message "Division by zero is undefined!" Sample output 1: Enter 2 integers (the second being non-zero): 15 6 15 / 6 2 %3D r 15 % 6 3 Sample output 2: Enter 2 integers (the second being non-zero): 15 0 Division by zero is undefined!
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,