Drawing a rectangle

  • 4
  • Locked
Expressive drawing using the modest tools of pseudographics is the same as minimalism in music. At least, some critics on Earth think so. Well, let's heed their words and do some drawing. Let's enter two numbers m and n, and draw a rectangle of eights. The rectangle will be m eights high and n eights wide.
You can't complete this task, because you're not signed in.
Comments(15)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Lex IconLevel 5 , Sofia
Thursday, 12:17
Seems, the conditions were being described by a very lazy person as it could have been described a bit more detailed, considering we don't deal with the geometry on a daily basis, and neither all of us Native EN speakers. So, the task wasn't hard, the hard part was to figure out what they want from us. Nevertheless, the extra skills of being able to understand poorly explained description have been achieved.
Roman HryhorchukLevel 9 , Cracow
21 August, 17:11
I don't understand this - The program should display a n x m rectangle made of eights. 3*4 = 12, so maybe rectangle of 12th?
Roman HryhorchukLevel 9 , Cracow
21 August, 17:25
Ok, I believe I got it, three rows and 4 columns
Lucas HoageLevel 14 , Savannah
26 May, 04:07
It was so absolutely obvious once I moved the next line within the loop what I was doing wrong. My code was right, but new lines were being created before numbers. What it tells me is that the compiler truly does go line by line.
Jimmy PhanLevel 7 , Atlanta
24 October 2019, 17:57
Not sure if this will really help anyone out but; I renamed m as rows and n as columns. It might help you get a better understanding of which loop is doing what.
Asma SadiaLevel 15 , Brooklyn
9 October 2019, 05:04
Don't print n*m. It just wants you print the number eight.
Sam Level 13 , ELIZABETH
15 November 2019, 13:03
they should have used numbers that does not coincidentally multiplies to 8
aemLevel 18 , Amsterdam
4 July, 16:14
I'm proud of you @Asma. You made my day...I thought n*m. So, that took me a lot of time..until I read your comment ;)
Sean NigitoLevel 6 , Newark
12 August, 15:17
yeah they should have picked different numbers for the example
Tauqeer ArifLevel 7 , Jhelum
5 October 2019, 07:10
What the hell is going on ?
Azhar IqbalLevel 18 , Multan
29 August 2018, 12:03
for(int i=0; i<8; i++){
          for(int x=0; x < 4;x++){
              System.out.print(n*m);
          }
          System.out.println();
      }
What's the problem how many times in rows display the text???
RomanLevel 41
30 August 2018, 05:39
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.
RyonLevel 9 , Manila
16 September 2018, 23:36
Your program should be reading a keyboard input. Do not explicitly indicate a constant in your for loop conditions
for(int i=0; i<8; i++) { // I am talking about i < 8
          for(int x=0; x < 4;x++){ // and this x < 4
               System.out.print(n*m); // Watch out for this...
           }
           System.out.println();
       }
And also, your program should just be printing the number '8' when making the box.
18 March 2019, 20:12
package com.codegym.task.task04.task0436;
/*
Drawing a rectangle
*/
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

public class Solution {
    public static void main(String[] args) throws Exception {
     ...
    }
}
RomanLevel 41
19 March 2019, 08:29
Posting the solution in the comments is prohibited.