# Printing and Loop Practice

You are the programmer in charge of the multiplication table team. You will be given two numbers, `a` and `b`. Can you print all the multiples of `a` from `a` through a*b? Please them on one line, separated by spaces.

### Challenge

Print the numbers from `a` through a*b.

Alternatively, you can try out Learneroo before signing up.

• #### David

I am getting runtime error everytime System.out.println(); is being executed.

• #### Learneroo

@David, your code looks like it runs ok. How would you print the next different multiple of `a` each time, when you have an index `i` that increases each time?

• #### David

Hi, thanks for the answer. The runtime error was showing up before I clicked reset, seems it cached some error? Anyway great work this website.

• #### Tom Stevens

Can you tell me what I've done wrong in the code below:

For (int index=a, index=<b, int index = index + 1){

• #### Learneroo

To fix the syntax errors, replace `=<` with `<=` and remove the second `int` since you've already declared `index` as an int in the beginning. You can click on the buttons on the side for help with syntax.

• #### Dino Šišić

if someone is looking for some other solution here is mine and it includes 1 if:

``````public static void doStuff(int a, int b){
for (int i=a;i<=a*b;i=i+1){
if (i%a==0){
System.out.print(i + " ");
}
}
}
``````
• #### Michał Targiel

CORRECT:

public class Main {

``````public static void doStuff(int a, int b){
for(int i=1; i<=b ; i=i+1){
System.out.print(" "+ a*i);
``````
• I am constantly getting the following runtime errors:

Main.java:13: error: class, interface, or enum expected
public static void main(String[] args) {

• #### Learneroo

@Joshua, careful with `{}`. Reset the code and put back code in the method body.

• #### catypus

What development app should I use to try this on my own? NetBeans? I've heard of that one...

• #### Learneroo

In the next module, we suggest beginners use BlueJ to get started. Afterwards, you can use any of the main IDEs (Netbeans, Eclipse or IntelliJ)

• #### Jaci Covington

Why do we have to put the print statement for the space on a separate line? I had no luck with (m, ' ')