Untitled
unknown
c_cpp
a year ago
304 B
1
Indexable
Never
#include <iostream> using namespace std; int main() { int n; cin >> n; int max = 0; int min = 9; { for (int i = 0; n>0; i++) { if (n % 10 > max) { max = n % 10; } if (n % 10 < min) { min = n % 10; } n = n / 10; } } cout << min << " " << max; }