Something is wrong with my box program :C
Hello everyone!
So my teacher asked us to make a box in a particular size based on the users input.
Specifically he only wanted the top left and bottom of a box.
But I happen to be really bad with while loops and stuff, but here is my program so far.
Code:
/*This programe creates a box based on input from user*/
#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;
while (newtop != num) {
newtop = top + 1 ;
printf("*");
}
while (side!= top) {
oside = side + 1;
printf("*\n");
}
while(bot!= top) {
obot = bot + 1;
printf("*");
}
return 0;
}
When I excute the program I see nothing but stars, however it compiles with no error.
Any help would be appreciated and thank you in advance !