Issue
CodeHi there, I am trying to make an app which shows the table of a number given by user. I am able to get only last answer of a table, for example, it only shows 5*10=50 but i want whole table from 1 to 10. For reference, I've also attached some images of the app. please help.
Solution
Here is simple solution for java developers
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();
Answered By - gulab patel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.