Here is a Java Program to Print the Table
Explanation of Above Java Program
In Above Java Program
public class Table {
public static void main(String[] args) {
int no = Integer.parseInt(args[0]);
// count from i = 1 to 10
int i = 1;
while (i <= 10) {
System.out.println(i*no);
i++;
}
}
}
/**************************
*
* % java Table 5
* 5
* 10
* 15
* 20
* 25
* 30
* 35
* 40
* 45
* 50
*
**************************/
Explanation of Above Java Program
In Above Java Program
- we are taking command line argument from user.
- Initializing the Integer i with 1.
- Looping through the WHILE until i is more than 10.
- Printing the Value with println.
thanks for giving a such a easy solution
something wrong in this program with variable......!!!!!!