I am trying to print a rectangle using this symbol *. When I print it, it draws an L.
What is wrong with my code?
#include <stdio.h>
void rect(int base, int height)
{
int x = 0,y = 0;
while(x < height)
{
x++;
if(x == 1 || x == height)
{
while(y < base)
{
y++;
printf("*");
}
}
printf("\n*");
}
}
int main ()
{
rect(5,5);
system("pause");
return 0;
}