Write a Java program that takes a two digit number from user and print product of the digits.
Answers
Answer:
class Calculate {
public static void calculate() {
Scanner br = new Scanner(System.in);
int[] c = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
int[] d = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
int sum;
int a = br.nextInt();
System.out.println("Digit is:" + a);
for (int i = 0; i < 10; i++) {
int e = 0;
if (a == ((c[i] * 10) + d[e])) {
sum = ((c[i] * 10) + d[e]);
System.out.println("First digit is:" + c[i]
+ " Second digit is:" + d[e]
+ "\n" + "Sum of digits=" + sum);
} else if (i == 9) {
i = 0;
e++;
} else if (e == 10) {
System.out.println("INVALID NO. HAS BEEN DETECTED");
}
}
}
}
Explanation:
hope it helps you
Answer:
please explain please explain please explain