Skip to content
Advertisement

How to generate a number pattern with given start and end value?

How can i generate a number pattern like this using php?

a. Start = 1, End = 3
    123
    231
    312
b. Start = 2 , End = 7
    234567
    345672
    456723
    567234
    672345
    723456

UPDATE: I tried this code:

JavaScript

and get this output:

JavaScript

But how to show the rest numbers?

Advertisement

Answer

you can try this algorithm:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement