> but its not working
That's because it's got syntax errors and won't compile. Also, when I said two loops inside another loop, I didn't mean two nested loops, I meant something like this:
Code:
#include <stdio.h>
int main(void)
{
int n, i, j, k;
int space, fill;
printf("enter number:");
scanf("%d", &n);
space = 2;
fill = 2;
for (i = 0; i < n; i++)
{
for (j = 0; j < space; j++)
printf(" ");
for (k = 0; k < fill; k++)
printf("*");
printf("\n");
}
return 0;
}
Now all you need to do is fix the spacing, which shouldn't be difficult if you do what I described in my last post.