How can i write a java program to display the multiplication table for the number entered by the user and the values doesn’t exceed 100 .For example if the user enter 3 the output should be like this :

3

6

9

12

15

18

21

24

27

30

33

36

39

42

45

48

51

54

57

60

63

66

69

72

75

78

81

84

87

90

93

96

99

Respuesta :

tonb

Answer:

import java.util.Scanner;

public class Main {

 public static void main(String[] args) {

   Scanner input = new Scanner(System.in);

   System.out.println("Enter an integer");

   int num = input.nextInt();

   int i=1;

   while( i*num < 100) {

      System.out.println(i*num);

      i++;

   }

   input.close();

 }

}

Explanation:

If you want the value 100 to be included, change the < to <=.