Computer Science, asked by anshikashukla89, 4 months ago

(1) Write the statement to input a float type value using scanner class.​

Answers

Answered by Anonymous
1
  • import java.util.*;
  • public class
  • ScannerNextFloatExample4 {
  • public static void main(String args[]){
  • Float number;
  • Scanner scan = new Scanner( System.in );
  • System.out.print("Enter the numeric value : ");
  • number = scan.nextFloat();
  • System.out.println("Float value : " + number +" \nTwice value : " + 2.0*number );
Answered by Anonymous
1

Answer:

Example 4

import java.util.*;

public class ScannerNextFloatExample4 {

public static void main(String args[]){

Float number;

Scanner scan = new Scanner( System.in );

System.out.print("Enter the numeric value : ");

number = scan.nextFloat();

System.out.println("Float value : " + number +" \nTwice value : " + 2.0*number );

Similar questions