Loop_Practise_Que_11

Home / Java Practice Question / Loop_Practise_Que_11

Loop_Practise_Que_11


Write a Java program to display the multiplication table of a given integer.
Test Data


Input the number (Table to be calculated) : 5

Expected Output :                                                                   
5 X 1 = 5                                                                       
5 X 2 = 10                                                                      
5 X 3 = 15                                                                      
5 X 4 = 20                                                                      
5 X 5 = 25  . . . . . .

Program : - 



public class Loop {
public static void table(int num){

for(int i=1;i<=10;i++){
System.out.println(num + " x " + i + " = " + num*i);
}
}
}