(1) Write the statement to input a float type value using scanner class.
Answers
Answered by
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
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