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); 
 }
};

Edited 6 Years Ago by peter_budo: Please do not use CODE SNIPPED option to post question. Use FORUM THREAD!

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

Comments
helped me

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

Edited 6 Years Ago by ttboy04: n/a

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

Comments
1
This question has already been answered. Start a new discussion instead.