![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0zCvRyGJAbc5snqDv2OlEsUF6gmgx3RfsjEW0DTYdE0Epb63fcIF2JwawDJarVrui2YbJBjeJx1DbI6KQuG9CCLKc7VS2YmR3xOohqZ7_-77DECkhFKqxvBLM_31jDV7uB7XSkthu4nlk/s640/C+Program+To+Print+Alphabet+pattern.jpg)
Using this program user can print following pattern
A
B B
C C C
D D D D
Program:
//C Program to print Pattern by www.SlashMyCode.com
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
for(i=0;i<=3;i++)
{
for(j=i;j<=3;j++)
{
printf("\t");
}
for(j=0;j<=i;j++)
{
printf("\t%c\t",'A'+i);
}
printf("\n");
}
getch();
}
Output:
This is the output you will get if you run the above program
Algorithm:
- Start
- define i,j
- i=0 if i<=3,i++ if YES then go to STEP 4 if NO then go to STEP 9
- j=1 if j<=3,j++ if YES than go to STEP 5 if NO then go to STEP 6
- print space and go to STEP 4
- j=0 if j<=i,i++ if YES go to STEP 7 if NO than go to STEP 8
- print space char space then go to STEP 6
- print new line(\n) then go to STEP 3
- Stop
No comments:
Post a Comment
Feel free to ask us any question regarding this post