Hello everyone, I am almost finished writing a box program based on the users input of the size of the box.
So far my program is
Code:
#include <stdio.h>
int
main(void)
{
int num;
int top;
int newtop;
int oside;
int obot;
int bot;
int side;
printf("Enter the size of a box: "); /*takes input from user*/
scanf("%d", &num);
top = 0;
side = 0;
bot = 0;
newtop = 0;
oside = 0;
obot = 0;
while (newtop != num) {
newtop++ ;
printf("*");
}
while (side != num) {
side++ ;
printf("*\n");
}
while(bot != num) {
bot++ ;
printf("*");
}
return 0;
}
A sample run of the program :
Code:
linux3[3]% ./a.out
Enter the size of a box: 5
******
*
*
*
*
*****
linux3[4]%
However to complete the project how would I go about printing a box like this
http://tinyurl.com/3kr3unl
Any help would be appreciated ! Thank you in advance