# Multiply a number by 10 using bitwise operator

Here given code implementation process.

``````// C Program
// Multiply a number by 10 using bitwise operator
#include <stdio.h>

void multiplyBy10(int num)
{
// Shift the number to the left by 3
// Shift the number to the left by 1
int result = ((num) << 3) + ((num) << 1);
// Display calculated result
printf(" (%d x 10) %d\n", num, result);
}
int main()
{
// Test
multiplyBy10(6);
multiplyBy10(10);
multiplyBy10(7);
multiplyBy10(-3);
return 0;
}``````

#### Output

`````` (6 x 10) 60
(10 x 10) 100
(7 x 10) 70
(-3 x 10) -30``````
``````/*
Java program
Multiply a number by 10 using bitwise operator
*/
public class Multiplication
{
public void multiplyBy10(int num)
{
// Shift the number to the left by 3
// Shift the number to the left by 1
int result = ((num) << 3) + ((num) << 1);
// Display calculated result
System.out.println(" (" + num + " x 10) " + result);
}
public static void main(String[] args)
{
// Test
}
}``````

#### Output

`````` (6 x 10) 60
(10 x 10) 100
(7 x 10) 70
(-3 x 10) -30``````
``````// Include header file
#include <iostream>
using namespace std;
/*
C++ program
Multiply a number by 10 using bitwise operator
*/
class Multiplication
{
public: void multiplyBy10(int num)
{
// Shift the number to the left by 3
// Shift the number to the left by 1
int result = ((num) << 3) + ((num) << 1);
// Display calculated result
cout << " (" << num << " x 10) " << result << endl;
}
};
int main()
{
// Test
return 0;
}``````

#### Output

`````` (6 x 10) 60
(10 x 10) 100
(7 x 10) 70
(-3 x 10) -30``````
``````// Include namespace system
using System;
/*
Csharp program
Multiply a number by 10 using bitwise operator
*/
public class Multiplication
{
public void multiplyBy10(int num)
{
// Shift the number to the left by 3
// Shift the number to the left by 1
int result = ((num) << 3) + ((num) << 1);
// Display calculated result
Console.WriteLine(" (" + num + " x 10) " + result);
}
public static void Main(String[] args)
{
// Test
}
}``````

#### Output

`````` (6 x 10) 60
(10 x 10) 100
(7 x 10) 70
(-3 x 10) -30``````
``````package main
import "fmt"
/*
Go program
Multiply a number by 10 using bitwise operator
*/

func multiplyBy10(num int) {
// Shift the number to the left by 3
// Shift the number to the left by 1
var result int = ((num) << 3) + ((num) << 1)
// Display calculated result
fmt.Printf("(%d x 10 ) %d \n",num, result)
}
func main() {

// Test
multiplyBy10(6)
multiplyBy10(10)
multiplyBy10(7)
multiplyBy10(-3)
}``````

#### Output

`````` (6 x 10) 60
(10 x 10) 100
(7 x 10) 70
(-3 x 10) -30``````
``````<?php
/*
Php program
Multiply a number by 10 using bitwise operator
*/
class Multiplication
{
public	function multiplyBy10(\$num)
{
// Shift the number to the left by 3
// Shift the number to the left by 1
\$result = ((\$num) << 3) + ((\$num) << 1);
// Display calculated result
echo(" (".\$num.
" x 10) ".\$result.
"\n");
}
}

function main()
{
// Test
}
main();``````

#### Output

`````` (6 x 10) 60
(10 x 10) 100
(7 x 10) 70
(-3 x 10) -30``````
``````/*
Node JS program
Multiply a number by 10 using bitwise operator
*/
class Multiplication
{
multiplyBy10(num)
{
// Shift the number to the left by 3
// Shift the number to the left by 1
var result = ((num) << 3) + ((num) << 1);
// Display calculated result
console.log(" (" + num + " x 10) " + result);
}
}

function main()
{
// Test
}
main();``````

#### Output

`````` (6 x 10) 60
(10 x 10) 100
(7 x 10) 70
(-3 x 10) -30``````
``````#    Python 3 program
#    Multiply a number by 10 using bitwise operator
class Multiplication :
def multiplyBy10(self, num) :
#  Shift the number to the left by 3
#  Shift the number to the left by 1
result = ((num) << 3) + ((num) << 1)
#  Display calculated result
print(" (", num ," x 10) ", result)

def main() :
#  Test

if __name__ == "__main__": main()``````

#### Output

`````` ( 6  x 10)  60
( 10  x 10)  100
( 7  x 10)  70
( -3  x 10)  -30``````
``````#    Ruby program
#    Multiply a number by 10 using bitwise operator
class Multiplication
def multiplyBy10(num)
#  Shift the number to the left by 3
#  Shift the number to the left by 1
result = ((num) << 3) + ((num) << 1)
#  Display calculated result
print(" (", num ," x 10) ", result, "\n")
end

end

def main()
#  Test
end

main()``````

#### Output

`````` (6 x 10) 60
(10 x 10) 100
(7 x 10) 70
(-3 x 10) -30
``````
``````/*
Scala program
Multiply a number by 10 using bitwise operator
*/
class Multiplication()
{
def multiplyBy10(num: Int): Unit = {
// Shift the number to the left by 3
// Shift the number to the left by 1
var result: Int = ((num) << 3) + ((num) << 1);
// Display calculated result
println(" (" + num + " x 10) " + result);
}
}
object Main
{
def main(args: Array[String]): Unit = {
var task: Multiplication = new Multiplication();
// Test
}
}``````

#### Output

`````` (6 x 10) 60
(10 x 10) 100
(7 x 10) 70
(-3 x 10) -30``````
``````/*
Swift 4 program
Multiply a number by 10 using bitwise operator
*/
class Multiplication
{
func multiplyBy10(_ num: Int)
{
// Shift the number to the left by 3
// Shift the number to the left by 1
let result: Int = ((num) << 3) + ((num) << 1);
// Display calculated result
print(" (", num ," x 10) ", result);
}
}
func main()
{
// Test
}
main();``````

#### Output

`````` ( 6  x 10)  60
( 10  x 10)  100
( 7  x 10)  70
( -3  x 10)  -30``````
``````/*
Kotlin program
Multiply a number by 10 using bitwise operator
*/
class Multiplication
{
fun multiplyBy10(num: Int): Unit
{
// Shift the number to the left by 3
// Shift the number to the left by 1
val result: Int = ((num) shl 3) + ((num) shl 1);
// Display calculated result
println(" (" + num + " x 10) " + result);
}
}
fun main(args: Array < String > ): Unit
{
// Test
}``````

#### Output

`````` (6 x 10) 60
(10 x 10) 100
(7 x 10) 70
(-3 x 10) -30``````

## Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.