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

for loop