Print Star pattern by using C language
Print Star pattern
#include<stdio.h>
void StarPattern(int rows)
{
for (int i = 0; i < rows; i++)
{
for (int j = 0; j <= i; j++)
{
printf("*");
}
printf("\n");
}
}
int main()
{
int rows;
printf("How many star patterns do you want?\n");
scanf("%d", &rows);
StarPattern(rows);
return 0;
}
Now enter the input that how many rows do you want to print and press "Enter" and see
the result.
Happy Programming.
Comments
Post a Comment