Multiply by 2

The program must accept a number and multiply it by 2.

Example Input/Output 1:
Input:
10

Output:
20

Example Input/Output 2:
Input:
50

Output:
100

Python

X = int(input())
print(X*2)

Java

import java.util.*;
public class Hello {
    public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
System.out.print(N*2);
}
}

C

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int N;
    scanf("%d",&N);
    printf("%d",N*2);
}

C++

#include <iostream>
using namespace std;
int main()
{
    int X;
    cin >> X;
    cout << X*2
    return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

More posts. You may also be interested in.