Răspuns:
a) 9831
b) 1000
Explicație: Uite algoritmul in c++
#include <iostream>
using namespace std;
int main()
{
unsigned int n,a,b,m;
cout<<"n=";
cin>>n;
a=n%10;
m=a;
while(n>9)
n=n/10;
b=n%10;
if(a>b)
m=m*10+b;
a=b;
}
cout<<m;
return 0;