You are to write a program which takes in a pair of positive integers, n and m ,
ID: 3536392 • Letter: Y
Question
You are to write a program which takes in a pair of positive integers, n and m,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
(0 < m _ n < 20), and outputs all the possible permutations of choosing m integers from the set f {1, 2, %u2026 , n}. The input is just one line with two integers separated by a white space. The output should print one permutation per line, and a final line containing the number of permutations printed.
Important:
Your program should prompt the user for input, and it should accept only valid input. Your output should be organized as follows:
Sample Input Sample Output
3 2 1 2
1 3
2 1
2 3
3 1
3 2
6
Explanation / Answer
#include #include #include int lev=-1,n,val[50],a[50]; void main() { int i,j; clrscr(); printf("Enter how many numbers? "); scanf("%d",&n); printf(" Enter %d numbers: ",n); for(i=0;iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.