Problem Statement
You’re given a number num. You need to find and print the largest and smallest digit of num.
Example 1: Let num = 238627
8 is the largest and 2 is the smallest digit of 238627.
Thus, the output is:
Largest Digit: 8
Smallest Digit: 2
Example 2: Let num = 34552
5 is the largest and 2 is the smallest digit of 34552.
Thus, the output is:
Largest Digit: 5
Smallest Digit: 2
Example 3: Let num = 123
3 is the largest and 1 is the smallest digit of 123.
Thus, the output is:
Largest Digit: 3
Smallest Digit: 1
C++ Program to Find the Largest and Smallest Digit of a Number
Below is the C++ program to find the largest and smallest digit of a number:
Output:
Python Program to Find the Largest and Smallest Digit of a Number
Below is the Python program to find the largest and smallest digit of a number:
Output:
JavaScript Program to Find the Largest and Smallest Digit of a Number
Below is the JavaScript program to find the largest and smallest digit of a number:
Output:
C Program to Find the Largest and Smallest Digit of a Number
Below is the C program to find the largest and smallest digit of a number:
Output:
Java Program to Find the Largest and Smallest Digit of a Number
Below is the Java program to find the largest and smallest digit of a number:
Output:
Boost Your Python Skills Using Built-In Methods and Functions
Python Standard Library provides a number of built-in methods and functions that are used to perform a variety of tasks. Methods and functions increase the code clarity and efficiency. Leverage the power of methods and functions to boost up your Python skills.