Program to print the following pattern:-
*
***
*****
*******
*********
***********
*************
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, rows= 7, k=0;
clrscr();
printf("The pattern is below: \n");
for ( a=1; a<=rows; ++a, k=0)
{
for (b=1; b<=rows-a; ++b)
{
printf(" ");
}
while (k != 2*a-1)
{
printf("* ");
++k;
}
printf("\n");
}
getch();
}
*
***
*****
*******
*********
***********
*************
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, rows= 7, k=0;
clrscr();
printf("The pattern is below: \n");
for ( a=1; a<=rows; ++a, k=0)
{
for (b=1; b<=rows-a; ++b)
{
printf(" ");
}
while (k != 2*a-1)
{
printf("* ");
++k;
}
printf("\n");
}
getch();
}