Skip to main content

Posts

Showing posts with the label 9.Write a Java program to print multiplication table of any number.

ads1

9.Write a Java program to print multiplication table of any number.

 9.Write a Java program to print multiplication table of any number. Static :-  class loop9 { public static void main(String[] args) {           int num = 5;         for(int i = 1; i <= 10; ++i)         {             System.out.printf("%d * %d = %d \n", num, i, num * i);         }     } } Output :-  Dynamic :- import java.util.*; class loop9 { public static void main(String args[] ) { int n,i; Scanner in = new Scanner(System.in); System.out.println("Enter the number :-  "); n=in.nextInt(); for(i=1;i<=10;i++) { System.out.printf("%d * %d = %d \n",n,i,n*i); } } } Output :-  

ads2