Print the star triangle pattern using C
Hey guys once again welcome to the Decoders blog, I hope you all are doing well and today I'm present with another logic but this time with something different it is a C logic which will help us to print a beautiful pattern using C language.
Here is the pattern that we are trying to print
*
**
***
****
*****
and so on upto n number of rows
Here is the code for the given pattern which you can use
#include<stdio.h>
int main()
{
int n;
printf("Enter the values of n: ");
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
printf("*");
}
printf("\n");
}
return(0);
}
Comments
Post a Comment