Write a class MultiplicationtTable to accept a number to find the table calculation of it till 10.

0

Assignment: Module 03- Part 02

Write a class MultiplicationtTable to accept a number to find the table calculation of it till 10.
Assignment: Module 03- Part 02

Write a class MultiplicationtTable to accept a number to find the table calculation of it till 10.

Input: 

Enter the no. 3

Output: 

1*3=3

2*3=6

3*3=9

4*3=12

5*3=15

6*3=18

7*3=21

8*3=24

9*3=27

10*3=30

import java.util.Scanner;

public class MultiplicationTable {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      System.out.print("Enter the number: ");
      int num = sc.nextInt();

      for (int i = 1; i <= 10; i++) {
         System.out.println(i + " * " + num + " = " + (i * num));
      }
   }
}   

And here is a sample output for the input 3:

Enter the number: 3
1 * 3 = 3
2 * 3 = 6
3 * 3 = 9
4 * 3 = 12
5 * 3 = 15
6 * 3 = 18
7 * 3 = 21
8 * 3 = 24
9 * 3 = 27
10 * 3 = 30   

👉Write a class MaxThree to accept three numbers and find the maximum in it.👈

Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
✨ Updates