Java program to print table of n number from given range m to n.

import java.util.Scanner;
public class TableFromMtoN{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter the range of numbers from m to n for the multiplication table: ");
        int m = scanner.nextInt();
        int n = scanner.nextInt();
if(m<=n){
int x=m;
while(x<=n){
        System.out.println("Multiplication table for " + x + ":");

        for (int i = 1; i <= 10; i++) {
            int result = x * i;
            System.out.println(x + " * " + i + " = " + result);
        }
        x++;
       }
}
else{
System.out.println(" Numbers Range is Wrong,try Again");
}
}
}

Comments

Popular posts from this blog

Java program to implement file input stream class to read binary data from image file.

Java program to find length of given string and convert it in to upper or lower case.

Java program to read a text file and displays it's contents on screen.

Java program to check marks out of Bound exception.

Java program to calculate area and perimeter of circle using interfaces.

Java program to check greatest among three numbers where input numbers are given by user.

Java program to merge two text files in to third file.

Java Applet program to draw rectangle and right-aligned oval of orange color.

Concatenating and Buffering Files in Java जावा में फ़ाइलों को जोड़ना और बफर करना