#include <stdio.h> int main(void) { char a; char b; char c; scanf(" %c ", &a); scanf(" %c ", &b); scanf(" %c ", &c); //this is the line I added to get this output xyz xzy yxz yzx zxy zyx printf("%c %c %c %c %c %c," abc, acb, bac, bca, cab, cba); printf("\n"); return 0; }
printf("%c%c%c ",a,b,c); printf("%c%c%c ",b,c,a); printf("%c%c%c ",c,a,b);
Quote:What is wrong with the printf statement in this code
printf("%c %c %c %c %c %c," abc, acb, bac, bca, cab, cba); // ^ this is for 1 char only, but you want 3 chars at a time // ^ the comma, here, should be after double quptes // ^ here is a new undefined variable, not a combination of 3 variables
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)