Write a program to find the double of the given number without using arithmetic operator

27 April 2022

Write a program to find the double of the given number without using arithmetic operator


Description

For the given input number, calculate the double of it without using an arithmetic operator.

 

Input

4

Output

8


C Program

#include <stdio.h>

int main()

{

    int num;

    printf("Enter a number: ");

    scanf("%d",&num);

    printf("%d",num<<1);

    return 0;

}


C++ Program

#include <iostream>

using namespace std;

int main()

{

    int  num;

    cout<<"Enter a number: ";

    cin>>num;

    cout<<(num<<1);

    return 0;

}


Java

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

Scanner sc=new Scanner(System.in);

System.out.print("Enter the number: ");

int num = sc.nextInt();

System.out.println(num<<1);

}

}


Python

num=int(input("Enter a number: "))

print(num<<1)

Related Articles

Ask Us Anything !