Program to print pattern using for loop
* * * * *
* * * *
* * *
* *
*
#include<stdio.h>
void main()
{
int
row,i,j;
printf("Enter the number of
rows you want: \n");
scanf("%d",&row);
for(i=row;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("*
");
}
printf("\n");
}
}
Output:
Enter the
number of rows you want: 5
* * * * *
* * * *
* * *
* *
*
No comments:
Post a Comment