{ A destination to learn coding }

Pattern - Half Pyramid using *

*
* *
* * *
* * * *
* * * * *

#include <stdio.h>
int main()
{
int i,j,a;
printf("Enter the number of rows\n");
scanf("%d",&a);

for(i=0;i<a;i++)
{
	for(j=0;j<=i;j++)
	{printf("*");}
printf("\n");
}
return 0;
}

Pattern - Half Pyramid using Alphabets

A
B B
C C C
D D D D
E E E E E

#include <stdio.h>
int main()
{
int i,j,a;
char alpha='A';
printf("Enter the number of rows\n");
scanf("%d",&a);

for(i=0;i<a;i++)
{
	for(j=0;j<=i;j++)
	{
		printf("%c",alpha);
	}
	printf("\n");
	alpha++;
}
return 0;
}

Pattern - Half Pyramid using Numbers

1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

#include <stdio.h>
int main()
{
int i,j,a,num=1;
printf("Enter the number of rows\n");
scanf("%d",&a);

for(i=0;i<a;i++)
{
	for(j=0;j<=i;j++)
	{
		printf("%d",num);
	}
	printf("\n");
	num++;
}
return 0;
}

Pattern - Half Pyramid using Numbers

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

#include <stdio.h>
int main()
{
int i,j,a,num;
printf("Enter the number of rows\n");
scanf("%d",&a);

for(i=0;i<a;i++)
{
	num=1;
	for(j=0;j<=i;j++)
	{
		printf("%d",num);
		num++;
	}
	printf("\n");
}
return 0;
}