#include <stdio.h>
int main()
{
// stair cases:
// #
// ##
// ###
// ####
// #####
int n;
printf("enter the number of entry: ");
scanf("%d", &n);
// there will be three <for loops>. first loop will execute for <endline>, second will be for <tabs> & third for #.
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n - i; j++)
{
printf(" "); //j for <tabs> & no.of tabs = (total - no.of #s/i)
}
for (int k = 1; k <= i; k++)
{
printf("#"); //i for #s & no.of #s = i
}
printf("\n");
}
return 0;
}
// Prgrammer: TEJAS
 |
Output
|
Comments
Post a Comment