+ 2
How to write a java class which multiply long numbers? The class will receive multiplicand and multiplier as string input
3 ответов
+ 3
in this first read the value from user.In java user valus are in string format then convert it from string to int by using Integer.parseInt wrapper clases and then print its product
+ 2
import util.scanner.*;
class Sample {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int multiplicant = Integer.parseInt(sc.nextInt);
int multiplier = Integer.parseInt(sc.nextInt);
int product = multiplicant * multiplier;
System.out.println(" product is:" +product);
}
}
+ 2
oh thank you!