Demo entry 6647603

work

   

Submitted by Liu on Oct 20, 2017 at 14:22
Language: C++. Code size: 584 Bytes.

#include <iostream>

using namespace std;

int main()
{
    int str[4];
    int num=1;
    while (num<10000)
    {
        for (int i=0; i<4; i++)
        {
            str[i] = num % 10;
            num = num / 10;
        }
        
        num = str[0] + 10*str[1] + 100*str[2] + 1000*str[3];
        
        if (str[0]<str[1] && str[1]<str[2] && str[2]<str[3]
            ||str[0]<str[1] && str[1]<str[2] && str[3]==0
            ||str[0]<str[1] && str[2]==0 && str[3]==0)
        {
            cout << num << endl;
        }
        num += 1;
    }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).