Find the largest and smallest digit each number in a set of ten numbers
Answers
Answered by
3
Explanation:
int largest = 0;
int smallest = 9;
while (n) {
int r = n % 10;
// Find the largest digit
largest = max(r, largest);
// Find the smallest digit
smallest = min(r, smallest);
n = n / 10;
}
cout << largest << " " << smallest;
I think
}
Answered by
0
Answer:
the above answer is correct
Similar questions
Science,
4 hours ago
Math,
4 hours ago
Math,
4 hours ago
CBSE BOARD X,
7 hours ago
Math,
7 months ago