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.

*

*    *

*    *    *

*    *    *    *

*    *    *    *    *

*    *    *    *    *    *

*    *    *    *    *    *    *

Share:

No comments:

Post a Comment

Popular Posts

Contact Form

Name

Email *

Message *

Recent Posts

Copyright Matlab Project Codes All rights Reserved. Powered by Blogger.

Blog Archive