Given a number, the task is to multiply it with 10 without using multiplication operator?

Examples:

Input : n = 50 Output: 500 // multiplication of 50 with 10 is = 500 Input : n = 16 Output: 160 // multiplication of 16 with 10 is = 160

A **simple solution** for this problem is to run a loop and add n with itself 10 times. Here we need to perform 10 operations.

A **better solution** is to use bit manipulation. We have to multiply n with 10 i.e; n*10, we can write this as **n*(2+8) = n*2 + n*8** and since we are not allowed to use multiplication operator we can do this using left shift bitwise operator. So n*10 = n<<1 + n<<3.

## C++

`// C++ program to multiply a number with 10 using ` `// bitwise operators ` `#include<bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to find multiplication of n with ` `// 10 without using multiplication operator ` `int` `multiplyTen(` `int` `n) ` `{ ` ` ` `return` `(n<<1) + (n<<3); ` `} ` ` ` `// Driver program to run the case ` `int` `main() ` `{ ` ` ` `int` `n = 50; ` ` ` `cout << multiplyTen(n); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java Code to Multiply a number with 10 ` `// without using multiplication operator ` `import` `java.util.*; ` ` ` `class` `GFG { ` ` ` ` ` `// Function to find multiplication of n ` ` ` `// with 10 without using multiplication ` ` ` `// operator ` ` ` `public` `static` `int` `multiplyTen(` `int` `n) ` ` ` `{ ` ` ` `return` `(n << ` `1` `) + (n << ` `3` `); ` ` ` `} ` ` ` ` ` `/* Driver program to test above function */` ` ` `public` `static` `void` `main(String[] args) ` ` ` `{ ` ` ` `int` `n = ` `50` `; ` ` ` `System.out.println(multiplyTen(n)); ` ` ` ` ` `} ` `} ` ` ` `// This code is contributed by Arnav Kr. Mandal. ` |

*chevron_right*

*filter_none*

## Python 3

`# Python 3 program to multiply a ` `# number with 10 using bitwise ` `# operators ` ` ` `# Function to find multiplication ` `# of n with 10 without using ` `# multiplication operator ` `def` `multiplyTen(n): ` ` ` ` ` `return` `(n << ` `1` `) ` `+` `(n << ` `3` `) ` ` ` `# Driver program to run the case ` `n ` `=` `50` `print` `(multiplyTen(n)) ` ` ` `# This code is contributed by ` `# Smitha ` |

*chevron_right*

*filter_none*

## C#

`// C# Code to Multiply a number with 10 ` `// without using multiplication operator ` `using` `System; ` ` ` `class` `GFG { ` ` ` ` ` `// Function to find multiplication of n ` ` ` `// with 10 without using multiplication ` ` ` `// operator ` ` ` `public` `static` `int` `multiplyTen(` `int` `n) ` ` ` `{ ` ` ` `return` `(n << 1) + (n << 3); ` ` ` `} ` ` ` ` ` `// Driver Code ` ` ` `public` `static` `void` `Main() ` ` ` `{ ` ` ` `int` `n = 50; ` ` ` `Console.Write(multiplyTen(n)); ` ` ` ` ` `} ` `} ` ` ` `// This code is contributed by Nitin Mittal. ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to multiply a ` `// number with 10 using ` `// bitwise operators ` ` ` `// Function to find multiplication ` `// of n with 10 without using ` `// multiplication operator ` `function` `multiplyTen(` `$n` `) ` `{ ` ` ` `return` `(` `$n` `<< 1) + (` `$n` `<< 3); ` `} ` ` ` ` ` `// Driver Code ` ` ` `$n` `= 50; ` ` ` `echo` `multiplyTen(` `$n` `); ` ` ` `// This code is contributed by nitin mittal. ` `?> ` |

*chevron_right*

*filter_none*

Output:

500

This article is contributed by **Shashank Mishra ( Gullu )**. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Multiplying a variable with a constant without using multiplication operator
- Divide two integers without using multiplication, division and mod operator
- Multiply any Number with 4 using Bitwise Operator
- Multiply a number by 15 without using * and / operators
- Calculate 7n/8 without using division and multiplication operators
- Multiplication of two numbers with shift operator
- Find XOR of two number without using XOR operator
- Smallest string without any multiplication sign that represents the product of two given numbers
- Compare two integers without using any Comparison operator
- Find largest element from array without using conditional operator
- Maximum OR value of a pair in an Array without using OR operator
- Check a number is odd or even without modulus operator
- Russian Peasant (Multiply two numbers using bitwise operators)
- Efficient way to multiply with 7
- Multiply a given Integer with 3.5
- Multiplication with a power of 2
- Booth’s Multiplication Algorithm
- Calculate square of a number without using *, / and pow()
- Increment a number without using ++ or +
- Find the remainder when N is divided by 4 using Bitwise AND operator