Program to display right angled triangle of star (asterisk)

Below the program in C that will display right angled triangle of star/asterisk. The program will use for and while loop to display the star/asterisk on the screen.

Expected Output

*
**
***

Here is the code,

#include<stdio.h>
#include<conio.h>
void main()
{
	int i, counter;
	clrscr();
	for(i=0; i<3; i++)
	{
		counter = 0;
		while(counter <= i){
			printf("*");
			counter++;
		}
		printf("\n");
	}
	getch();
}

This C Program is brought you by LearnCOnline.com

You may also like...

2 Responses

  1. shanthanapandiyan says:

    for loop

  1. May 29, 2015

    […] Program in C to display right angled triangle of star (asterisk) […]

Leave a Reply

Your email address will not be published. Required fields are marked *

FREE C Cheatsheet - Speed Up Your C Programming.

FREE C Cheatsheet - Speed Up Your C Programming.

Download a 7-page free cheat sheet for easy and quick access to C Concepts, Snippets, and Syntax.

Thank you! Check you inbox and access your cheat-sheet