wap in Java to input two no. and find their product withiut using *
Answers
Answered by
2
Answer:
import java.util.Scanner;
public class abc {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a,b,product=0;
System.out.println("enter number 1");
a=sc.nextInt();
System.out.println("enter number 2");
b=sc.nextInt();
for(;b>0;b--)
product+=a;
System.out.println(product);
}}
Explanation:
logic is multiplication is just adding the number again and again required no of times
Similar questions