JAVA CODE 6. Largest Digit by CodeChum Admin This one is a bit tricky. You're going to have to isolate each digit of the integer to determine which one is the largest, so good luck!   Instructions: Input a 3-digit integer. Print the largest digit in the integer. Tip #1: Use % 10 to get the rightmost digit. For example, if you do 412 % 10, then the result would be the rightmost digit, which is 2. Tip #2: On the other hand, use / 10 to remove the rightmost digit. For example, if you do 412 / 10, then the result would be 41. Tip #3: You'd have to repeat Tip #1 and Tip #2 three times for this problem because the input is a 3-digit integer. Instructions Input one 3-digit integer. Print the largest digit in the integer. (Hint: use % 10 to get the rightmost digit and / 10 to remove it) Input A line containing a three-digit integer. 173 Output A line containing a single-digit integer 7

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter2: Elements Of High-quality Programs
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

JAVA CODE

6. Largest Digit

by CodeChum Admin

This one is a bit tricky. You're going to have to isolate each digit of the integer to determine which one is the largest, so good luck!

 

Instructions:

  1. Input a 3-digit integer.
  2. Print the largest digit in the integer.
  3. Tip #1: Use % 10 to get the rightmost digit. For example, if you do 412 % 10, then the result would be the rightmost digit, which is 2.
  4. Tip #2: On the other hand, use / 10 to remove the rightmost digit. For example, if you do 412 / 10, then the result would be 41.
  5. Tip #3: You'd have to repeat Tip #1 and Tip #2 three times for this problem because the input is a 3-digit integer.

Instructions

  1. Input one 3-digit integer.
  2. Print the largest digit in the integer. (Hint: use % 10 to get the rightmost digit and / 10 to remove it)

Input

A line containing a three-digit integer.

173

Output

A line containing a single-digit integer

7
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT