Table of number

Java Program For table of a number entered by User

Implementation :-

import java.util.Scanner;
public class Table
{
    public static void main(String[] args)
    {
        System.out.println("Enter a number: ");
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        for(int i=1; i<=10; i++)
           {
               System.out.println(num+" x "+i+ " = "+i*num);
           }
    }
}


 Output:
   
D:\AllPrograms\1232>javac Table.java
D:\AllPrograms\1232>java Table
Enter a number:
34
34 x 1 = 34
34 x 2 = 68
34 x 3 = 102
34 x 4 = 136
34 x 5 = 170
34 x 6 = 204
34 x 7 = 238
34 x 8 = 272
34 x 9 = 306
34 x 10 = 340

 

Comments

Popular posts from this blog

C program that contains a string XOR each character in this string with 0 ,127

Queue in Data Structure(DS)

Implementation of stack Using Array