The assignment ask for a looping statement and should print out a table of values
for example
N 10*n 100*n 1000*n
1 10 100 1000
2 2 200 2000

my code just prints the N 10*n 100*n 1000*n

I am a noob at this but really trying! Can anyone help please!
Your help is greatly appreciated.

public class tableOfValues
{

 public static void main(String args[])
{
int multiple = 0;

System.out.println("N 10*N 100*N 1000*N");
for (int i = 1; i <= multiple; ++i)
{
System.out.println(Integer.valueOf(i)+" "
+Integer.valueOf(10*i)+" "+
+Integer.valueOf(100*i)+" "+
+Integer.valueOf(1000*i));
}
System.exit(0);
}
}

Recommended Answers

All 2 Replies

int multiple = 0;

here is the error when multiple= 0 then it never enter the for loop since 1>multiple

just make multiple =2 and it should work

Thank you!
It Worked!

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.