Output all combinations of character variables a, b, and c, in the order shown below. If a = 'x', b = 'y', and c = 'z', then the output is:
xyz xzy yxz yzx zxy zyx
#include <stdio.h>
int main() {
char a = 'x';
char b = 'y';
char c = 'z';
printf("%c%c%c ", a, b, c);
printf("%c%c%c ", a, c, b);
printf("%c%c%c ", b, a, c);
printf("%c%c%c ", b, c, a);
printf("%c%c%c ", c, a, b);
printf("%c%c%c ", c, b, a);
}
Comments
Leave a comment