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
Math,
1 month ago
English,
1 month ago
Math,
1 month ago
CBSE BOARD X,
2 months ago
Math,
9 months ago