Advertisement
kamandos

HW4

Jun 27th, 2022
866
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     static void Table(int num, int i)
  5.     {
  6.         System.out.print("\n");
  7.         System.out.print(num+" X "+i+" = "+num*i);
  8.         if(i<10)
  9.             Table(num, i+1);
  10.     }
  11.  
  12.     public static void main(String[] args) {
  13.         Scanner cs=new Scanner(System.in);
  14.             int num;
  15.  
  16.             System.out.print("Enter a number:");
  17.             num=cs.nextInt();
  18.  
  19.             System.out.print("Multiplication Table of "+num+" is:");
  20.             Table(num, 1);
  21.             cs.close();
  22.     }
  23.  
  24. }
Advertisement
RAW Paste Data Copied
Advertisement