C program to print combinations from three digits.

Q44. Write a C program to accept three digits (that is, 0-9) and print all possible combinations from these digits. (For example, if the three digits are 1, 2 and 3 then all possible combinations are 123, 132, 231, 213, 312 and 321).

Ans.

#include<stdio.h>  //for standard input and output

#include<conio.h>  //for clrscr();

 

//Main Function

void main()

{

int a[3],i,n=0,swap; Read More …

C++ program to accept three digits (that is, 0-9) and print all possible combinations.

Q24. Write a program to accept three digits (that is, 0-9) and print all possible combinations from these digits. (For example, if the three digits are 1, 2 and 3 then all possible combinations are 123, 132, 231, 213, 312 and 321).

Ans.

#include<iostream.h>

#include<conio.h>  //for clrscr();

 

//Main Function

void main()

{

int a[3],i,n=0,swap;

clrscr();  //for clear screen

cout<<“\n Enter three numbers: “; Read More …