Hello,

I am trying output number of repetion from user request. So basically there will be repetition print out of the times table when the user enter in the "Enter repetition" dialogbox. For example in the "Enter repetition" dialogbox, i will enter 2, then in "Which timestable do you want" dialogbox, i will enter 5. so the output will loop twice 2 to show 5 times table upto 12. I cannot output the loop for example twice. Where am I going wrong.

Thanks in advance

int number; 
{
number= Integer.parseInt(Dialog.input("Enter repetition?"));

number= Integer.parseInt(Dialog.input("Which timestable do you want?"));

 for(int a =1;a<=12; a++) 
 { 
  System.out.println(a + " times " +number + " is " + a * number); 
 }
};

int number;
{
number= Integer.parseInt(Dialog.input("Enter repetition?"));
number= Integer.parseInt(Dialog.input("Which timestable do you want?"));
for(int a =1;a<=12; a++)
{
System.out.println(a + " times " +number + " is " + a * number);
}
};

just add another loop...

int number; 
int number2;
     {
      number2= Integer.parseInt(Dialog.input("Enter repetition?"));
      number= Integer.parseInt(Dialog.input("Which timestable do you want?"));
for(int i = 1;i <= number2;i++)
{
      for(int a =1;a<=12; a++)
      {
      System.out.println(a + " times " +number + " is " + a * number);
      }
}
      };

that should work

commented: helped me +0

Oh gosh, I am such a homer simpson sometimes. thanks. How do I make this solve.

there should be a mark as solved button around the bottom somewhere... add reputation where needed :D thanx

commented: 1 +1
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.