Filled Under:

C program to print the pattern


C program to print the pattern

C program to print the pattern

 In this program, I have discussed about the c program to print the pattern

#include<stdio.h>
int main()
{
int i,j,k,l,m;char a;
for(i=1;i<=7;i++)
{a='A';
for(j=0;j<=7-i;j++,a++)
printf("%c ",a);
for(k=2;k<(2*i)-1;k++)
printf("  ");
if(i==1)
{
a=a-2;
for(l=1;l<=7-i;l++,a--)
printf("%c ",a);
}
else
{a=a-1;
for(m=0;m<=7-i;m++,a--)
printf("%c ",a);
}
printf("\n");
}
}

Just copy and paste the program in your desired compiler (Dev C++ is more preferable) and run it.

Enjoy programming in C.

0 comments:

Post a Comment

 

Copyright 2020 Programming in C All Right Reserved