我正在制作一个显示数字 table 的应用程序,但它只显示最后一次计算,我想要从 1 到 10 的所有计算

I am making an app which shows table of a number but it only shows last calculation, i want all the calculations from 1 to 10

Code您好,我正在尝试制作一个显示用户给定号码的 table 的应用程序。例如,我只能得到 table 的最后一个答案,它只显示 5*10=50 但我想要整个 table 从 1 到 10。作为参考,我还附上了一些应用程序的图像。请帮忙

我认为你的逻辑是错误的,请检查你的循环语句。如果你想要从 1 到 10 的整个 table 结果,那么你应该开始从 1 到 10 循环递增。

for(int i = 1; i < = 10; i++) {
            Log.d((input+" * "+i+" = "+ input * i );    
        }
Thanks

这是针对 java 开发人员

的简单解决方案
int a  = 1; //User Input
StringBuilder table = new StringBuilder();
for(int i = 1; i <= 10; i++) {
    table.append(a).append(" * ").append(i).append(" = ").append(a * i).append("\n");
}
String finalTable = table.toString();