#include
int main(void)
{
int width = 0;
int height = 0;
printf("Enter the box width and height size separated by a space: ");
scanf("%d", &width);
scanf("%d", &height);
for(int row = 0 ; row<=height ; row++)
{
printf("\n");
for(int col = 0 ; col<=width ; col++)
{
if(row == 0||row==height-1)
{
printf("*");
continue;
}
/* An * in 1st & last column, otherwise a space */
printf("%c", ((col==0 || col==width-1) ? '*' :' '));
}
}
printf("\n");
return 0;
}
No comments:
Post a Comment