Discover new knowledge and insights with IDNLearn.com's extensive Q&A database. Ask your questions and receive prompt, detailed answers from our experienced and knowledgeable community members.
Sagot :
Answer:
Follows are the cdo0de to this question:
import java.util.*;//package
public class Table //defining class Table
{
public static void main(String[] asx)//main method
{
int x,y,i;//defining integer variables
Scanner bg=new Scanner(System.in);//creating Scanner class object
System.out.print("Enter first number: ");//print message
x=bg.nextInt();//input value
System.out.print("Enter Second number: ");//print message
y=bg.nextInt();//input value
for(i = 1; i <= y; i++)//defining for loop for print Table
{
System.out.printf("%d * %d = %d \n", x, i, x * i);//calculate and print table
}
}
}
Output:
Enter first number: 5
Enter Second number: 3
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
Explanation:
In the above code, three integer variable "x,y, and i" is declared, in which "x,y" variable is used to input value from the user end, and after input, the value the for loop is used, in which the second variable "y" count the rows, and "i, x" variable is used for calculates the multiplication of the table.
We appreciate your contributions to this forum. Don't forget to check back for the latest answers. Keep asking, answering, and sharing useful information. IDNLearn.com has the solutions to your questions. Thanks for stopping by, and come back for more insightful information.