Pattern 6:
Discussion:
Reverse form of pattern 2. Using scanf() function to take user input.Code:
#include <stdio.h>int main()
{
int n, i, k, j;
printf("how many row you want : ");
scanf("%d", &n);
for(i=1;i<=n;i++)
{
for(k=0;k<=i;k++)
{
printf(" ");
}
for(j=n;j>=i;j--)
{
printf("*");
}
printf("\n");
}
return 0;
}
Post a Comment