Answer:
// Here is code in C.
#include "stdio.h"
// create function to print all the combinations
void print_combi(char a,char b,char c)
{
// print all combinations of three characters
printf("%c%c%c %c%c%c %c%c%c %c%c%c %c%c%c %c%c%c\\",a,b,c,a,c,b,b,a,c,b,c,a,c,a,b,c,b,a);
}
// driver function
int main(void)
{
// create 3 char variable and initialize
char a='x',b='y',c='z';
// call the function
print_combi(a,b,c);
printf("\\");
// initialize with different character
a='1',b='2',c='3';
// call the function
print_combi(a,b,c);
printf("\\");
// initialize with different character
a='#',b='$',c='%';
// call the function
print_combi(a,b,c);
printf("\\");
return 0;
}
Step-by-step explanation:
Create three char variables a, b, c. First initialize them with x, y, z. then call the function print_combi() with three parameters . this function will print all the combinations of those characters.We can test the function with different values of all the three char variables.
Output:
xyz xzy yxz yzx zxy zyx
123 132 213 231 312 321
#$% #%$ $#% $%# %#$ %$#