this is the question . will someone guide me how to draw lines vertically and horizntly . Draw lines Write a program that displays - a horizontal line of 10 eights - a vertical line of 10 eights Use “for” loop.

asked 25 Mar '15, 17:42

Muhammad%20Hassan%20Durrani's gravatar image

Muhammad Has...
4311224
accept rate: 0%


may be with two cycle: first cycle System.out.print(); second cycle System.out.println();

link

answered 25 Mar '15, 19:28

Joseph's gravatar image

Joseph
213
accept rate: 0%

public class Solution { public static void main(String[] args) throws Exception { for (int i = 1 ; i <= 10; i++) { System.out.print(8); } for (int j = 1 ; j < 10; j++) { System.out.println(8); } } }

link

answered 09 Apr '15, 04:27

Khawer%20Sandhu's gravatar image

Khawer Sandhu
1
accept rate: 0%

it is not passing test plz help

(22 Apr '15, 10:26) Khawer Sandhu

public class Solution { public static void main(String[] args) throws Exception { for (int i = 1 ; i <= 10; i++) { System.out.print(8); } for (int j = 1 ; j < 10; j++) { System.out.println(8); } } }

link

answered 22 Apr '15, 10:26

Khawer%20Sandhu's gravatar image

Khawer Sandhu
1
accept rate: 0%

the output is correct but not passing the test. anyone can help please?
for (int i = 1 ; i < 10; i++) { System.out.print("8"); } for (int j = 0 ;j < 10; j++) { System.out.println("8"); }

link

answered 23 Apr '15, 18:42

rahul's gravatar image

rahul
7916
accept rate: 15%

found the correct solution! the trick is you've to print out row and column separately don't mix em up. just add a line "System.out.println()" between the two for loops and print out 10 eights in each for loop.

link

answered 28 Apr '15, 23:37

rahul's gravatar image

rahul
7916
accept rate: 15%

edited 28 Apr '15, 23:39

public class Solution
{
    public static void main(String[] args) throws Exception
    {
        //add your code here
        for (int i = 0 ; i < 10; i++) { 
            System.out.print(8);
        }
        System.out.println();
        for (int j = 0 ; j < 10; j++) { 
            System.out.println(8);
        } 
    }
}
link

answered 20 Jun, 10:11

MykytaZ's gravatar image

MykytaZ
11
accept rate: 0%

public class Solution { public static void main(String[] args) throws Exception {

    for(int i = 1;i<=10;i++)
    {
        System.out.print(8);
    }
    System.out.println();
    for(int j = 1;j<=10;j++)
    {
        System.out.println(8);
    }

}

}

✓ The program is compiled without errors. ✓ The program has passed all tests. You’ve completed the task!

link

answered 07 Jul, 01:00

dan's gravatar image

dan
11
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×69
×36
×3

Asked: 25 Mar '15, 17:42

Seen: 2,186 times

Last updated: 07 Jul, 01:00