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......

Recommended Answers

All 5 Replies

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?

Thanks:) to Java Addict and Grn Xtrm

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.

code

commented: new thread -1
commented: You may want to try asking a question next time. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.