Q:

write program to generate following pattern

0

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

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Programming Exercises With Solutions

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
write program to generate following pattern... >>
<< Write program to display number 1 to 10 in octal, ...