Computer Science, asked by Aadithi36, 2 months ago

Find the largest and smallest digit each number in a set of ten numbers

Answers

Answered by kaurashpreet52
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 tonystark87
0

Answer:

the above answer is correct

Similar questions