Drawing a rectangle

  • 4
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 (19)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
KARMA GURUNG Level 5, Wyken, United Kingdom
17 February, 14:20
continuously print 8 (n) no. of times in single line, once it done change the line repeat it for (m) no. of times hint : double for loop
Khong. Ph. Level 5, Chiangrai, Thailand
25 January, 15:19
I cleared about this mission this mission doesn't want m x n = 8 they want to see 8 in this result such as input>>> n = 5 , m = 3 Result:: 888 888 888 888 888 ==OR== input>> n = 2, m = 10 Result:: 8888888888 8888888888 .... I think It can help you to understand... Good Luck
Cristian Level 12, Ploiesti, Romania
31 October 2020, 18:26
A m x n rectangle made of eights!
Lex Icon Level 17, Sofia, Bulgaria
24 September 2020, 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.
Khong. Ph. Level 5, Chiangrai, Thailand
25 January, 15:08
I think so
Roman Hryhorchuk Level 17, Cracow, Poland
21 August 2020, 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 Hryhorchuk Level 17, Cracow, Poland
21 August 2020, 17:25
Ok, I believe I got it, three rows and 4 columns
Lucas Hoage Level 14, Savannah, United States
26 May 2020, 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 Phan Level 7, Atlanta, United States
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 Sadia Level 15, Brooklyn, United States
9 October 2019, 05:04
Don't print n*m. It just wants you print the number eight.
Sam Level 13, ELIZABETH, United States
15 November 2019, 13:03
they should have used numbers that does not coincidentally multiplies to 8
aem Level 20, Amsterdam, Netherlands
4 July 2020, 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 Nigito Level 6, Newark, United States
12 August 2020, 15:17
yeah they should have picked different numbers for the example
Tauqeer Arif Level 7, Jhelum, Pakistan
5 October 2019, 07:10
What the hell is going on ?
Azhar Iqbal Level 18, Multan, Pakistan
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???
Roman Level 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.
Ryon Level 9, Manila, Philippines
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.
Алекс Фердинанд Level 8, Mirnyy, Russian Federation
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 {
     ...
    }
}
Roman Level 41
19 March 2019, 08:29
Posting the solution in the comments is prohibited.