I need to create a hollow rectangle but I'm allowed to use only one loop. The program works as-is, but I used two loops in my code and don't know how to continue reducing the last one. (We have learnt only printf, scanf, if/else and loops, so no arrays etc.) The program scans height, width and thickness of the frame.
Could anyone possibly point me the right way?
the code looks like:
row = 0;
while(row < height)
{
column = 0;
while(column < width)
{
if(thickness > row) // upper border
{ printf("*");};
if( some conditions ) // left border
{ printf("*");};
if( conditions ) // hollow
{ printf(" ");};
if( conditions ) // right border
{ printf("*");};
if( conditions ) // bottom border
{ printf("*");};
column++;
};
puts("");
row++;
};