Question

# A function in **LANGUAGE C** that two positive integers j and f , and works as follows

1.

prints all increasing sequences of length f consisting of the numbers 1...j

2. returns the number of such sequences. For example

int print_f_sequences( int j, int f)

For example, print_f_sequences( 5 , 3) prints the following sequences

1 2 3

1 2 4

1 2 5

1 3 4

1 3 5

1 4 5

2 3 4

2 3 5

2 4 5

3 4 5

and returns 10

The specific order in which the sequences are printed is up to you. Add exactly one space

between numbers. Don't forget to separate the sequences with new lines.

Your function should work in reasonable time on inputs j,f up to 20.

[Hint: use recursion. You may also want to use a helper function]

print_k_sequences(8, 3): returns 56

print_k_sequences(6, 2): returns 15

#### Top Answer

Program: #include <stdio.h> void print_k_sequences ( int m, int n, unsigned char *c) { int i,count = 0 ; for (i = 0 ; i... View the full answer