give me some clues
priyantha s
Level 7
can you give some clues
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
JEAN CARLORS PAUL
14 November 2022, 23:14
I created two nested loops. The outer loop "while(i <= 10)" for each line and the inner loop "while(j <= 20)" for the elements of a line. During the loop I apply this condition: If we are in the first row or the last or the first column or the last print "B", otherwise print " ". And after each line without the last go into a new line.
Hope this can help. 😊😊
0
Thomas
13 November 2022, 16:41
I just was able to read the first line of the conditions. Create a (unfilled) rectangle with a width of 10 and a height of 20. The border is 'B's, the (un)fill probably spaces.
So you either create a char array, fill it with 'Bs', then fill the smaller inner with spaces and finally output it.
Or you print it directly. Then create nested loops for height and width (use meaningful variables like y and x :) )
If it's the first or last line (y), then for all columns (x) you should print a 'B'
otherwise if it's the first or last column (x), you should print a 'B'
otherwise you should print a space
Don't forget to advance to the next line when necessary...
0