Computer Science, asked by anilpatilkulkarni, 4 months ago

Write a code to read double data from the keyboard using Scanner

class.​

Answers

Answered by Mister360
0

Answer:

Code:-

import java.io.*;

import java.util.Scanner;

class DoubleDouble

{

public static void main (String[] args)

{

double value;

Scanner scan = new Scanner( System.in );

System.out.print("Enter a double:");

value = scan.nextDouble();

System.out.println("value: " + value +" twice value: " + 2.0*value );

}

}

Output:-

C:\temp>java DoubleDouble

Enter a double: 3.14

value: 3.14 twice value: 6.28

Answered by sravanthiyadavguda
0

Answer:

import java.util.*;

public class ScannerNextDoubleExample4 {

public static void main(String args[]){

double value;

Scanner scan = new Scanner(System.in);

System.out.print("Enter the numeric value : ");value = scan.nextDouble();System.out.println("Double value : " + value +" \nTwice value : " + 2.0*value )

Similar questions