Rezolvare in C++:
# include<iostream>
using namespace std;
int main()
{
unsigned i;
for(i=1000;i<=9999;i++)
if(i/1000>=i/100%10 && i/100%10>=i/10%10 && i/10%10>=i%10)
cout<<i<<" ";
return 0;
}
Daca doresti sa le afisezi in ordine strict descrescatoare, in loc de ">=" vei pune ">" .