Re: Code help, timestable
Please show what your program prints out now.
What is it supposed to print out?
Do you know how to code the expression to multiply a number by another number?
theProduct = anumber * anothernumber;
Your code does not do that any where. All I see are Strings being concatenated to one another.
String aStr = "5" + "*" + "1"; //==> gives the String: "5*1"
When you post code, please use the code tags to preserve its formatting. See: BB Code List - Java Programming Forums
What you have posted is very hard to read.
Re: Code help, timestable
You are making this way harder than it needs to be. to print a times table you need a loop but I don't see one in your code. All you have is several confusing if statements which are not needed.
Code java:
loop (12 times) {
print n * c = r;
}
Where n = the timestable you are printing (ie 5), c is a counter (1 - 12) and r is the result of multiplying n by c.
Re: Code help, timestable