C Program to print half pyramid as using "M"
/*C Program to print half pyramid as using "M"/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,rows;
printf("Enter the number of rows: ");
scanf("%d",&rows);
for(i=1;i<=rows;++i)
{
for(j=1;j<=i;++j)
{
printf("* ");
}
printf("\n");
}
getch();
}
Expected Output:
M
MM
MMM
MMMM
MMMMM
/*C Program to print pattern A BB CCC DDDD EEEEE FFFFFF*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
char input,temp='A';
printf("Enter uppercase character you want in triangle at last row: ");
scanf("%c",&input);
for(i=1;i<=(input-'A'+1);++i)
{
for(j=1;j<=i;++j)
printf("%c",temp);
++temp;
printf("\n");
}
getch();
}
Expected Output:
Enter uppercase character you want in triangle at last row: G
A
BB
CCC
DDDD
EEEEE
FFFFFF
GGGGGGG
Tags:
C Program to print half pyramid as using "*"
C PROGRAM TO PRINT TRIANGLE WITH "M"
piramid
print triangle with *
triangle