write program to generate following pattern
A B C D E F G
A B C E F G
A B F G
A G
Program:
#include<stdio.h> #include<conio.h> void main() { char c; clrscr(); for(c='A';c<='G';c++) { printf("%c" ,c); } printf("\n"); for(c='A';c<='G';c++) { if(c=='D') { printf(" ",c);continue;} printf(" %c" ,c); } printf("\n"); for(c='A';c<='G';c++) { if(c>='C'&&c<='E') { printf(" ",c);continue;} printf("%c" ,c); } printf("\n"); for(c='A';c<='G';c++) { if(c>='B'&&c<='F') { printf(" ",c);continue;} printf("%c" ,c); } printf("\n\n"); getch(); }
Output:
A B C D E F G A B C E F G A B F G A G
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Program:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer