Write a program to display multiplication table
import java.util.Scanner; public class multiplicationtable { public static void main(String[] args) { System.out.println("Enter the table number and the count value:"); Scanner sc=new Scanner(System.in); int tnum=sc.nextInt(); int count=sc.nextInt(); System.out.println("The table is ..."); for(int i=1;i<=count;i++){ System.out.println(tnum+"*"+i+"=" + i*tnum); } } } OUTPUT: Enter the table number and the count value: 8 10 The table is ... 8*1=8 8*2=16 8*3=24 8*4=32 8*5=40 8*6=48 8*7=56 8*8=64 8*9=72 8*10=80
No comments:
Post a Comment