0

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 by peter_budo: Please do not use CODE SNIPPED option to post question. Use FORUM THREAD!

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by phoenix911
Featured Replies
  • [QUOTE] 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); } };[/QUOTE] just add another loop... [CODE] int number; int number2; { number2= Integer.parseInt(Dialog.input("Enter repetition?")); number= Integer.parseInt(Dialog.input("Which timestable … Read More

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

1

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
0

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

Edited by ttboy04: n/a

1

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.