printing star with iteration
#include <stdio.h>
void star(int a);
int main()
{
int a;
printf("Enter how many rows you want to print:\n");
scanf("%d",&a);
star(a);
return 0;
}
void star(int a)
{
for (int i = 1; i <= a; i++)
{
for (int j = 0; j < (2 * i - 1); j++)
{
printf("*");
}
printf("\n");
}
}
Comments
Post a Comment