C program to print star pattern
/* C program to print following star pattern
codeMystery() */
* * * * *
* * * *
* * *
* *
*
Program:
#include<stdio.h>
void main()
{
int rows, i, j, k;
printf("Enter the number of rows: ");
scanf("%d", &rows);
for(i=1; i<=rows; i++)
{
for(j=rows; j>=i; j--)
{
printf(" ");
for(k=j; k<=j; k++)
{
printf("*");
}
}
printf("\n");
}
}
Output:
Comments
Post a Comment