Algorithm
- start
- input limit
- set i=1 and j=1
- repeat step 5 to step 8 until i<=limit otherwise go to step 9
- repeat step 6 until j<=i otherwise go to step 7
- display *
- i++
- go to step 4
- stop
#include<stdio.h>
#include<conio.h> //only windows users
void main()
{
int lim,i,j;
printf("\n enter the limit:\t");
scanf("%d",&lim);
for(i=1;i<=lim;i++)
{
printf("\n");
for(j=1;j<=i;j++)
{
printf("*");
}
}
getch(); //only windows users
}
Output
enter the limit: 4
*
**
***
****
No comments:
Post a Comment