51,641 views
34 votes
34 votes
Write a complete main that will input a decimal number, double it and display the results

Write a complete main that will input a decimal number, double it and display the-example-1
User Himanshu Bansal
by
2.9k points

1 Answer

10 votes
10 votes

Answer:

No sure what language you want but since I am best with Java.

class Main {

public static void main(String[] args) {

Scanner input = new Scanner(System.in); // Create a Scanner object

System.out.println("Enter Number");

double number01 = input.nextLine(); // Read user input

double multi = number01 * 2;

System.out.println("Number is " + multi); // Output user input

}

}

Step-by-step explanation:

User LCE
by
2.8k points