i wrote this question . i got the correct answear but it has not a pass testing . what it should be ??following is the question Multiplication table Write a program that displays multiplication table of 10 by 10. Use “while” loop. Separate numbers by a space. 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 ...

    int i=1,n;
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    //System.out.print("Enter the value of n:");
    n=Integer.parseInt(br.readLine());
        int row,column,y;
    //System.out.println("multiplication table");
    row=1;
    do
    { 
        column=1;
        do
        { 
            y=row*column;
            System.out.print(" "+y);
            column=column+1;
        }
        while(column<=n);
        System.out.println(" ");
        row=row+1;
    }
    while(row<=n);

asked 20 Mar '15, 15:17

Muhammad%20Hassan%20Durrani's gravatar image

Muhammad Has...
4311324
accept rate: 0%


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

    }

}
link

answered 12 Apr '15, 05:15

Gautam%20Roy's gravatar image

Gautam Roy
353
accept rate: 14%

All you need is two 'for' loops, one inside another.

link

answered 02 Apr '15, 11:23

Andrey's gravatar image

Andrey
1323
accept rate: 35%

Don't take input from user.. just keep n=10. you will past test.

link

answered 08 Apr '15, 21:30

Zain%20Mehar's gravatar image

Zain Mehar
13
accept rate: 0%

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

    }
}
link

answered 05 Feb '16, 12:54

Mohsin%20Choudhary's gravatar image

Mohsin Choud...
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:

×36
×11
×7

Asked: 20 Mar '15, 15:17

Seen: 5,926 times

Last updated: 05 Feb '16, 12:54