Write a program to enter a number and print smallest digit of given number.
Answers
Answered by
1
Answer:
- Take a number n as the input. An integer function smallest_digit(int n) takes 'n' as the input and returns the smallest digit in the given number. Now initialize min as the last digit of the given number. Iterate through the number and check if the number extracted is less than the minimum number.
Similar questions