In this section, us will learn how to multiply two numbers without utilizing the arithmetic operator (*) in Java.

You are watching: Multiply 2 numbers without using multiplication operator

The multiplication of 2 numbers deserve to be discovered by the repeated addition method. It means that add the number (multiplicand) into itself as much as multiplicator times. The an approach can be used if we desire to calculation the multiplication of little numbers.

Suppose, we desire to multiply 3 through 4 which provides 12 together the result. The same can be accomplished by adding 3 four times i.e. (3 + 3 + 3 + 3 = 12) or by adding 4 3 times i.e. (4 + 4 + 4 = 12). Both offer the exact same result. Therefore, we can implement the logic using recursion.

## Using for Loop

MultiplicationExample1.java

import java.util.Scanner;public class MultiplicationExample1{public revolution void main(String args<>) {Scanner sc=new Scanner(System.in);int x, y, sum=0;System.out.print("Enter the first number: ");x=sc.nextInt();System.out.print("Enter the 2nd number: ");y=sc.nextInt();//executes till the problem becomes falsefor(int i=1;i

Output:

Enter the an initial number: 6Enter the second number: 16The multiplication that 6 and also 16 is: 96
Let"s see an additional logic for the same.

MultiplicationExample2.java

import java.util.Scanner;public class MultiplicationExample2{public revolution void main(String args<>){int product=0;Scanner scan=new Scanner(System.in); System.out.print("Enter the an initial number: ");int multiplicand = scan.nextInt();System.out.print("Enter the 2nd number: ");int multiplicator = scan.nextInt();for(int i=0; i

Output:

Enter the very first number: 37Enter the second number: 23product of 37 and also 23 is: 851

## Using if Loop

MultiplicationExample3.java

import java.util.Scanner;public course MultiplicationExample3{public revolution void main(String args<>){int product=0; Scanner scan = brand-new Scanner(System.in); System.out.print("Enter the multiplicand: ");//reads one integer native the userint multiplicand = scan.nextInt();System.out.print("Enter the multiplicator: ");//reads an integer from the userint multiplicator=scan.nextInt();for(int i=0; i

Output:

Enter the multiplicand: 17Enter the multiplicator: 8The product the 17 and also 8 is: 136

## Using Recursion

By making use of the recursion, we can multiply 2 integers v the offered constraints.To main point a and b, recursively add a, b time.

See more: What Does Srsly Mean In Texting ? What Does Srsly Mean

Integers include both hopeful and an unfavorable numbers. The multiplier or multiplicand may host a optimistic or a negative sign prior to the number. No sign before a number represents a positive number. If the number holds a hopeful or a negative sign, they follow the rules, provided in the adhering to table.

## Help Others, you re welcome Share

React Native

Python design Patterns

Python Pillow

Python Turtle

Keras

Kibana

Mean Stack

Microprocessor

Mobile Computing

Mobile Testing

Nagios

Nifi

Online Marketing

OpenStack

PDF

## Preparation

Aptitude

Reasoning

Verbal Ability

Interview Questions

Company Questions

## Trending Technologies

Artificial Intelligence

AWS

Selenium

Cloud Computing

ReactJS

Data Science

Angular 7

Blockchain

Git

Machine Learning

DevOps

## B.Tech / MCA

DBMS

Data Structures

DAA

Operating System

Computer Network

Compiler Design

Computer Organization

Discrete Mathematics

Ethical Hacking

Computer Graphics

Software Engineering

Web Technology

Cyber Security

Automata

C Programming

C++

Java

.Net

Python

Programs

Control System

Data Mining

Data Warehouse

## dearteassociazione.org Services

dearteassociazione.org offers too plenty of high high quality services. Mail united state on , to get an ext information about given services.

Website DesigningWebsite DevelopmentJava DevelopmentPHP DevelopmentWordPressGraphic DesigningLogoDigital MarketingOn Page and Off web page SEOPPCContent DevelopmentCorporate TrainingClassroom and Online TrainingData entry

## Training because that College Campus

dearteassociazione.org uses college campus maintain on main point Java, development Java, .Net, Android, Hadoop, PHP, Web an innovation and Python. You re welcome mail your necessity at Duration: 1 week to 2 week

### Learn Tutorials

Learn JavaLearn Data StructuresLearn C ProgrammingLearn C++ TutorialLearn C# TutorialLearn PHP TutorialLearn HTML TutorialLearn JavaScript TutorialLearn jQuery TutorialLearn feather Tutorial

### Our Websites

dearteassociazione.orgHindi100.comLyricsia.comQuoteperson.comJobandplacement.com

### Our Services

Website Development

Android Development

Website Designing

Digital Marketing

Summer Training

Industrial Training

College Campus Training