C programmig : Output all combinations of character variables a, b, and c, using this ordering:abc acb bac bca cab cbaSo if a = 'x', b = 'y', and c = 'z', then the output is: xyz xzy yxz yzx zxy zyxYour code will be tested in three different programs, with a, b, c assigned with 'x', 'y', 'z', then with '#', '

Respuesta :

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\n",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("\n");

// initialize with different character

a='1',b='2',c='3';

// call the function

print_combi(a,b,c);

printf("\n");

// initialize with different character

a='#',b='

, '%', then with '1', '2', '3'.

Respuesta :

${data-answer}
,c='%';

// call the function

print_combi(a,b,c);

printf("\n");

return 0;

}

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

#$% #%$ $#% $%# %#$ %$#

A C program to find all combinations of character variables:

void main ()

{

       char f;

       char s;

       char t;

       f = 'x';

       s = 'y';

       t = 'z';

       System.out.print("" + f + s + t + " " + f + t + s + " " + s +f + t +

       " " + s + t + f + " " + t + f + s + " " + t + s + f);

  }

}

, '%', then with '1', '2', '3'.

Respuesta :

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\n",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("\n");

// initialize with different character

a='1',b='2',c='3';

// call the function

print_combi(a,b,c);

printf("\n");

// initialize with different character

a='#',b='

,c='%';

// call the function

print_combi(a,b,c);

printf("\n");

return 0;

}

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

#$% #%$ $#% $%# %#$ %$#

A C program to find all combinations of character variables:

void main ()

{

       char f;

       char s;

       char t;

       f = 'x';

       s = 'y';

       t = 'z';

       System.out.print("" + f + s + t + " " + f + t + s + " " + s +f + t +

       " " + s + t + f + " " + t + f + s + " " + t + s + f);

  }

}