RIGHT TRIANGLE STAR PATTERN
Consider the following I/O samples.
#include<stdio.h>
int main()
{
int n,row,col;
scanf("%d",&n);
printf("\n");
for(row=1;row<=n;row++)
{
for(col=1;col<=row;col++)
printf("* ");
printf("\n");
}
return 0;
}
The given source code in C program is short and simple to understand. The source code is well tested in DEV-C++ and is completely error free.
SAMPLE INPUT: 5
SAMPLE OUTPUT:
*
* *
* * *
* * * *
* * * * *
C PROGRAM:
#include<stdio.h>
int main()
{
int n,row,col;
scanf("%d",&n);
printf("\n");
for(row=1;row<=n;row++)
{
for(col=1;col<=row;col++)
printf("* ");
printf("\n");
}
return 0;
}
OUTPUT:
The given source code in C program is short and simple to understand. The source code is well tested in DEV-C++ and is completely error free.
If you have any feedback about this article and want to improve this, please comment in the comment section.
Comments
Post a Comment