We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

import java.io.*;
class times_table {
public static void main(String args[]) {
int i = 1;
System.out.println("Program for two's times table");
/* Loop the process using 'while' loop */
while(i <= 10) {
/* Print value of the variable 'i' and the value of multiplication with '2' at the same time */
System.out.println("2 x "+ i +" = "+ 2*i);
i++;
}
}
}
/* Output */
Program for two's times table
2 x 1 = 2
2 x 2 = 4
2 x 3 = 6
2 x 4 = 8
2 x 5 = 10
2 x 6 = 12
2 x 7 = 14
2 x 8 = 16
2 x 9 = 18
2 x 10 = 20