Computer Science, asked by Anonymous, 2 months ago

Write a program in java to display the table of a number. The program should accept the number via the scanner class.

(computer masters only) !

Answers

Answered by CopyThat
3

Program :-  {JAVA}

I had attached the program due to some technical issues (brainly).

Attachments:
Answered by BrainlyProgrammer
2

Answer:

import java.util.*;

class abc{

public static void main (String ar []){

Scanner sc=new Scanner(System.in);

System.out.println("Enter a number:-");

int n=sc.nextInt();

for(int I=0;I<=10;I++)

System.out.println(I+"×"+n+"="+(I*n));

}

}

Logic:-

  • Accept the number
  • Run I loop from 0 to 10
  • Multiply and print the product (I*n)

Output:-

Enter a number

5

0×5=0

1×5=5

2×5=10

3×5=15

4×5=20

5×5=25

6×5=30

7×5=35

8×5=40

9×5=45

10×5=50

Similar questions