Hi DaniWeb members:),

I hope we could discuss about this matter and please do give advise, feedback or respond regarding my answer code below:icon_smile:.

If the users enter x as 5, y as 6 the multiple table will be printed as below:

1*6=6
2*6=12
3*6=18
4*6=24
5*6=30

My answer code as below:-/:

/**
 * @(#)qoestion1.java
 *
 *
 * @author 
 * @version 1.00 2009/9/27
 */

public class qoestion1 {

    /**
     * Creates a new instance of <code>qoestion1</code>.
     */
    public qoestion1() {
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
      int x;
      int y=6;


      for (x=1;x<=5;x++)
      {
            System.out.println(x+"*"+y+"="+x*y);


      }
    }
}

Hope to hear your feedback as soon as posible :). I hope I at the right track.

thax......

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Well the code runs as it's supposed to be.
The code is not very complicated to provide any suggestions on how to do things differently

You can use Scanner objects to obtain user input for the values of x and y.
Try:

Scanner inputx = new Scanner(System.in);
Scanner inputy = new Scanner(System.in);
int x = inputx.nextInt();
int y = inputy.nextInt();

This should allow you to include user input in your program.
Is that what you are looking for?

Edited 7 Years Ago by Grn Xtrm: n/a

Please mark the thread as solved if your question has been answered. This way the other members of the community don't waste their time reading an already answered question.
Thanks.

This article has been dead for over six months. Start a new discussion instead.