我的代码是:
int loopVal;
int addition = 0;
int times_table = 0;
Scanner user_input = new Scanner(System.in);
………………………("Which times table do you want?");
times_table = user_input.nextInt();
for (loopVal = 1; loopVal < end_value; loopVal++) {
………………………………………….;
System.out.println(loopVal + " times " + times_table + " = " + addition);
}
我不确定如何去做,我不知道在这些空行中放什么或如何制作其余的代码。有人可以帮我帮忙吗?
答案 0 :(得分:0)
你在哪里决定函数的end_value?它是否作为函数的参数出现。 假设end_value作为函数的参数,
for (loopVal = 1; loopVal <= end_value; loopVal++)
{
// New addition is calculated with times_table getting multiplied from 1...end_value
addition = times_table * loopVal;
System.out.println(times_table + " times " + loopVal + " = " + addition);
}
如果我理解了你想要的东西,我想这会有用。