Subscribe

RSS Feed (xml)

Wednesday, July 29, 2009

Write a C program to print all Combinations of characters A, B, C

#include(stdio.h)
#include(conio.h)
int main( )
{
char ch1, ch2, ch3;
clrscr( );
for(ch1='A' ; ch1<='C' ; ++ch1)
{
for(ch2='A' ; ch2<='C' ; ++ch2)
for(ch3='A' ; ch3<='C' ; ++ch3)
printf(" %c %c %c", ch1, ch2, ch3);
}
getch( );
return 0;
}

Output:-
AAA AAB AAC ABA ABB ABC ACA ACB ACC
BAA BAB BAC BBA BBB BBC BCA BCB BCC
CAA CAB CAC CBA CBB CBC CCA CCB CCC

4 comments:

  1. i like ur programs.......
    but some programs r wrong

    ReplyDelete
  2. yo programs excellently written

    ReplyDelete
  3. how to write a code in c whose output is a dazzling falling star..

    ReplyDelete
  4. hi !!!
    I want to know how to write the code for the question bellow:
    input: i am good
    output:good am i

    ReplyDelete