*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
Program code
#include <stdio.h>
#include <conio.h>
void main()
{
int inner, outer, rows=1;
clrscr();
printf(“How many rows do you want to see? \n”);
scanf(“%d”, &rows);
printf(“The pattern is displayed below.\n”);
for (outer=1;outer<=rows;outer++)
{
for (inner=1;inner<=outer;inner++)
printf(“*\t”);
printf(“\n\n”);
}
getch();
}
Example of output
How many rows do you want to see?
7
The pattern is displayed below.
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
No comments:
Post a Comment