Showing posts with label increasing pattern. Show all posts
Showing posts with label increasing pattern. Show all posts

Wednesday, May 16, 2018

C program to display the following pattern.


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

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.
*
*    *
*    *    *
*    *    *    *
*    *    *    *    *
*    *    *    *    *    *
*    *    *    *    *    *    *