Ask Question

Output all combinations of character variables a, b, and c, using this ordering abc acb bac bca cab cba So if a x, b-y, and c-z, then the output is: xyz xzy yxz yzx zxy zyx Your code will be tested in three different programs, with a, b, c assigned with 'X, y, z', then with'#. $,'%, then with '1. '23 1 #include 2 using namespace std; 4 int main () 6 char b; 1 test passed char a; All tests passed char c; 10 12 Your solution goes here / cout << endl; return e; 13 14 16 17 18

+1
Answers (1)
  1. 3 October, 11:10
    0
    The solution is to use character variable and assign values and finally print all the combination of values.

    Explanation:

    public class AllCombinations {

    public static void main (String [] args) {

    //Declaring the variables

    char a1;

    char b1;

    char c1;

    //Assigning characters to form combinations

    a1 = 'x';

    b1 = 'y';

    c1 = 'z';

    //Printing the combinations

    System. out. print ("" + a1 + b1 + c1 + "/n " + a1 + c1 + b1 + "/n" + b1 + a1 + c1 + "/n" + b1 + c1 + a1 + "/n " + c1 + a1 + b1 + "/n " + c1 + b1 + a1);

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Output all combinations of character variables a, b, and c, using this ordering abc acb bac bca cab cba So if a x, b-y, and c-z, then the ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers