# Print all initials sequences of given length

Here given code implementation process.

// C program
// Print all initials sequences of given length
#include <stdio.h>

// Print the all combinations sequence of given length
void sequence(int number, int length, int n)
{
if (length == n)
{
// Display number
printf("\n %d", number);
return;
}
// Execute the loop from 1 to length
for (int i = 1; i <= length; ++i)
{
sequence((number *10) + i, length, n + 1);
}
}
int main()
{
// Test
sequence(0, 3, 0);
return 0;
}

#### input

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333
/*
Java Program for
Print all initials sequences of given length
*/
public class Combination
{
// Print the all combinations sequence of given length
public void sequence(int number, int length, int n)
{
if (length == n)
{
// Display number
System.out.print("\n " + number);
return;
}
// Execute the loop from 1 to length
for (int i = 1; i <= length; ++i)
{
sequence((number * 10) + i, length, n + 1);
}
}
public static void main(String[] args)
{
}
}

#### input

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333
#include <iostream>

using namespace std;
/*
C++ Program for
Print all initials sequences of given length
*/
class Combination
{
public:
// Print the all combinations sequence of given length
void sequence(int number, int length, int n)
{
if (length == n)
{
// Display number
cout << "\n " << number;
return;
}
// Execute the loop from 1 to length
for (int i = 1; i <= length; ++i)
{
this->sequence((number *10) + i, length, n + 1);
}
}
};
int main()
{
return 0;
}

#### input

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333
// Include namespace system
using System;
/*
Csharp Program for
Print all initials sequences of given length
*/
public class Combination
{
// Print the all combinations sequence of given length
public void sequence(int number, int length, int n)
{
if (length == n)
{
// Display number
Console.Write("\n " + number);
return;
}
// Execute the loop from 1 to length
for (int i = 1; i <= length; ++i)
{
this.sequence((number * 10) + i, length, n + 1);
}
}
public static void Main(String[] args)
{
}
}

#### input

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333
<?php
/*
Php Program for
Print all initials sequences of given length
*/
class Combination
{
// Print the all combinations sequence of given length
public	function sequence(\$number, \$length, \$n)
{
if (\$length == \$n)
{
// Display number
echo "\n ".\$number;
return;
}
// Execute the loop from 1 to length
for (\$i = 1; \$i <= \$length; ++\$i)
{
\$this->sequence((\$number * 10) + \$i, \$length, \$n + 1);
}
}
}

function main()
{
}
main();

#### input

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333
/*
Node JS Program for
Print all initials sequences of given length
*/
class Combination
{
// Print the all combinations sequence of given length
sequence(number, length, n)
{
if (length == n)
{
// Display number
process.stdout.write("\n " + number);
return;
}
// Execute the loop from 1 to length
for (var i = 1; i <= length; ++i)
{
this.sequence((number * 10) + i, length, n + 1);
}
}
}

function main()
{
}
main();

#### input

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333
#  Python 3 Program for
#  Print all initials sequences of given length
class Combination :
#  Print the all combinations sequence of given length
def sequence(self, number, length, n) :
if (length == n) :
#  Display number
print("\n ", number, end = "")
return

i = 1
#  Execute the loop from 1 to length
while (i <= length) :
self.sequence((number * 10) + i, length, n + 1)
i += 1

def main() :

if __name__ == "__main__": main()

#### input

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333
#  Ruby Program for
#  Print all initials sequences of given length
class Combination
#  Print the all combinations sequence of given length
def sequence(number, length, n)
if (length == n)
#  Display number
print("\n ", number)
return
end

i = 1
#  Execute the loop from 1 to length
while (i <= length)
self.sequence((number * 10) + i, length, n + 1)
i += 1
end

end

end

def main()
end

main()

#### input

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333
/*
Scala Program for
Print all initials sequences of given length
*/
class Combination()
{
// Print the all combinations sequence of given length
def sequence(number: Int, length: Int, n: Int): Unit = {
if (length == n)
{
// Display number
print("\n " + number);
return;
}
var i: Int = 1;
// Execute the loop from 1 to length
while (i <= length)
{
sequence((number * 10) + i, length, n + 1);
i += 1;
}
}
}
object Main
{
def main(args: Array[String]): Unit = {
var task: Combination = new Combination();
}
}

#### input

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333
/*
Swift 4 Program for
Print all initials sequences of given length
*/
class Combination
{
// Print the all combinations sequence of given length
func sequence(_ number: Int, _ length: Int, _ n: Int)
{
if (length == n)
{
// Display number
print("\n ", number, terminator: "");
return;
}
var i: Int = 1;
// Execute the loop from 1 to length
while (i <= length)
{
self.sequence((number * 10) + i, length, n + 1);
i += 1;
}
}
}
func main()
{
}
main();

#### input

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333
/*
Kotlin Program for
Print all initials sequences of given length
*/
class Combination
{
// Print the all combinations sequence of given length
fun sequence(number: Int, length: Int, n: Int): Unit
{
if (length == n)
{
// Display number
print("\n " + number);
return;
}
var i: Int = 1;
while (i <= length)
{
this.sequence((number * 10) + i, length, n + 1);
i += 1;
}
}
}
fun main(args: Array < String > ): Unit
{
}

111
112
113
121
122
123
131
132
133
211
212
213
221
222
223
231
232
233
311
312
313
321
322
323
331
332
333

## Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.