for n=4
*
* *
* * *
* * * *
code is below:
#include <stdio.h>
int main()
{
int num;
printf("Enter the number of row\n");
scanf("%d", &num);
for (int row = 1; row <= num; row++)
{
for (int column = 1; column <= num; column++)
{
if (column > num - row)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
return 0;
}
Comments
Post a Comment