Showing posts with label Data types. Show all posts
Showing posts with label Data types. Show all posts

Sunday, June 19, 2022

 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.


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);
  }
}

ads vert

Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody

  Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody < table >      < thead >    ...