# Number Star Alphabet Pattern programs

Following are the different number, star and alphabet pattern programs used infor logic building

1] Write a c program to print  star pattern
*
* *
* * *
* * * *

#include<stdio.h>
void main()
{
int i,j;
clrscr();
for(j=1;j<=4;j++)
{
for(i=1;i<=j;i++)
{
printf(” * “);
}
printf(“\n”);
}
getch();
}

2] Write a c program to print star pattern
* * * *
* * *
* *
*
#include<stdio.h>
void main()
{
int i,j;
clrscr();
for(j=4;j>=1;j–)
{
for(i=j;i>=1;i–)
{
printf(” * “);
}
printf(“\n”);
}
getch();
}

3] Write a c program to print star pattern
*
***
*****
*******
*********
#include <stdio.h>
int main()
{
int row, c, n, temp;
printf(“Enter the number of rows in pyramid of stars you wish to see “);
scanf(“%d”,&n);
temp = n;
for ( row = 1 ; row <= n ; row++ )
{
for ( c = 1 ; c < temp ; c++ )
printf(” “);
temp–;
for ( c = 1 ; c <= 2*row – 1 ; c++ )
printf(“*”);
printf(“\n”);
}
return 0;
}

4] Write a c program to print number pattern
1
1          2
1         2         3
1         2         3          4
1         2         3          4         5

#include<stdio.h>
void main()
{
int i,j;
clrscr();
for(j=1;j<=5;j++)
{
for(i=1;i<=j;i++)
{
printf(” %d “,i);
}
printf(“\n”);
}
getch();
}

5] Write a c program to print number pattern
1
232
34543
4567654
567898765
#include<stdio.h>
main()
{
int n, c, d, num = 1, space;
scanf(“%d”,&n);
space = n – 1;
for ( d = 1 ; d <= n ; d++ )
{
num = d;
for ( c = 1 ; c <= space ; c++ )
printf(” “);
space–;
for ( c = 1 ; c <= d ; c++ )
{
printf(“%d”, num);
num++;
}
num–;
num–;
for ( c = 1 ; c < d ; c++)
{
printf(“%d”, num);
num–;
}
printf(“\n”);
}
return 0;
}

6] Write a program to print alphabet pattern
A
b    c
D     E     F
g     h     i     j

int main()
{
int i,j,k,sp;
sp=’A’;
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)
{
if(i%2==1)
printf(“%c”,sp);
else
printf(“%c”,sp+32);
sp++;
}
printf(“\n”);
}
return 0;
}

7] Write a program to print alphabet pattern

a
b     C
d     E     f
g     H     i     J
int main()
{
int i,j,k,sp;
sp=’A’;
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)
{
if(j%2==0)
printf(“%c”,sp);
else
printf(“%c”,sp+32);
sp++;
}
printf(“\n”);
}
return 0;
}

8] Write a program to print alphabet pattern

*
*    A    *
*    A    *    A    *

int main()
{
int i,j,k,sp;
sp=3;
for(i=1;i<=5;i+=2)
{
for(k=1;k<=sp;k++)
printf(” “);
sp–;
for(j=1;j<=i;j++)
{
if(j%2==0)
printf(“A”);
else
printf(“*”);
}
printf(“\n”);
}
return 0;
}

## 2 thoughts on “Number Star Alphabet Pattern programs”

1. As per your request we are providing code for said program