Write a program to print the star pattern pyramid using the user defined function

//this is a program to print the star pattern using the user defined function
/*

*
* *
* * *
* * * *
* * * * *

*/
#include<stdio.h>
#include<conio.h>
void star(int rows);
void main()
{
int row;

printf("\n\nEnter the amount of rows: ");
scanf("%d",&row);
star(row);
getch();
}
void star(int rows)
{
int i,j;

for(i=1;i<=rows;i++)
{
printf("\n\n");
for(j=1;j<=i;j++)
printf(" * ");
}
}

Previous
Next Post »