Follow on Facebook

Like and Share on Facebook

Tuesday, February 10, 2015

Write a Program to Find Minimum Number B/W Two Numbers in Java Using Buffered Reader


import java.io.*;
import java.lang.Math;

class min
{
public static void main (String args[]) throws IOException
{
int a, e;
float b, f;
long c, g;
double d, h;


InputStreamReader ir=new InputStreamReader(System.in);

BufferedReader br =new BufferedReader(ir);

System.out.println("Please Enter the A Integer Value");

a=Integer.parseInt(br.readLine());

System.out.println("Please Enter the A Integer Value");

e=Integer.parseInt(br.readLine());

System.out.println("Please Enter the A Float Value");

b=Float.parseFloat(br.readLine());

System.out.println("Please Enter the A Float Value");

f=Float.parseFloat(br.readLine());


System.out.println("Please Enter the A Long Value");

c=Long.parseLong(br.readLine());

System.out.println("Please Enter the A Long Value");

g=Long.parseLong(br.readLine());


System.out.println("Please Enter the A Double Value");

d=Double.parseDouble(br.readLine());



System.out.println("Please Enter the A Double Value");

h=Double.parseDouble(br.readLine());

System.out.println(" Min Value b/w two Integer Numbers =" +Math.min(a,e));

System.out.println(" Min Value b/w two Float Numbers=" +Math.min(b,f));

System.out.println(" Min Value b/w two Long Numbers =" +Math.min(c,g));

System.out.println(" Min Value b/w two Double Numbers =" +Math.min(d,h));

}
}

--------------------Output--------------------

Please Enter the A Integer Value
45
Please Enter the A Integer Value
65
Please Enter the A Float Value
56.988
Please Enter the A Float Value
56.984
Please Enter the A Long Value
565555
Please Enter the A Long Value
565545
Please Enter the A Double Value
67.98888
Please Enter the A Double Value
67.98887
 Min Value b/w two Integer Numbers =45
 Min Value b/w two Float Numbers=56.984
 Min Value b/w two Long Numbers =565545
 Min Value b/w two Double Numbers =67.98887


Process completed.

No comments:

Post a Comment