Data types
Problem Statement
Some Data types are given below:-
Integer
Long
float
Double
char
Your task is to take input in the given format and print them in the same order.
Integer
Long
float
Double
char
Your task is to take input in the given format and print them in the same order.
import java.io.*;
import java.util.Scanner;
public class Main
{
public static void main(String[] args){
int a; long e; float b; double d; char ch ;
Scanner sc= new Scanner(System.in);
a = sc.nextInt();
System.out.println(a);
e = sc.nextLong();
System.out.println(e);
b = sc.nextFloat();
System.out.format("%.2f",b);
System.out.println();
d = sc.nextDouble();
System.out.format("%.4f",d);
System.out.println();
ch = sc.next().charAt(0);
System.out.println(ch);
}
}