Answers for "Multiplication table for number Java"

0

multiplication program java

int i,k;
			Scanner sc = new Scanner(System.in);
			System.out.println("Enter the Number for the table: ");

			int n = sc.nextInt();
			for (i=1;i<=10;i++){
				 k = n * i;
				//n + "*" + c + " = " + (n*c))
				System.out.println(n + "*"+ i + " = " + k);	
			}
Posted by: Guest on June-23-2020
-3

Multiplication table for number Java

public static String multiTable(int num) {
        StringBuilder sb = new StringBuilder();

        for (int i = 1; i <= 10; i++) {
            int result = i * num;
            sb.append(i + " * " + num + " = " + result + "\n");
        }
        return sb.toString().trim();
    }
Posted by: Guest on November-25-2020

Code answers related to "Multiplication table for number Java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language