import java.io.*;
import java.lang.Math;
class absolute
{
public static void main (String args[]) throws IOException
{
int a;
float b;
long c;
double d;
InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader br =new BufferedReader(ir);
System.out.println("Please Enter the Integer Value");
a=Integer.parseInt(br.readLine());
System.out.println("Please Enter the Float Value");
b=Float.parseFloat(br.readLine());
System.out.println("Please Enter the Long Value");
c=Long.parseLong(br.readLine());
System.out.println("Please Enter the Double Value");
d=Double.parseDouble(br.readLine());
System.out.println(" Integer Absolute Value =" +Math.abs(a));
System.out.println(" Float Absolute Value =" +Math.abs(b));
System.out.println(" Long Absolute Value =" +Math.abs(c));
System.out.println(" Double Absolute Value =" +Math.abs(d));
}
}
--------------------Output--------------------
Please Enter the Integer Value
-9
Please Enter the Float Value
-90.89
Please Enter the Long Value
-8987777
Please Enter the Double Value
-78.90888
Integer Absolute Value =9
Float Absolute Value =90.89
Long Absolute Value =8987777
Double Absolute Value =78.90888
Process completed.
import java.lang.Math;
class absolute
{
public static void main (String args[]) throws IOException
{
int a;
float b;
long c;
double d;
InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader br =new BufferedReader(ir);
System.out.println("Please Enter the Integer Value");
a=Integer.parseInt(br.readLine());
System.out.println("Please Enter the Float Value");
b=Float.parseFloat(br.readLine());
System.out.println("Please Enter the Long Value");
c=Long.parseLong(br.readLine());
System.out.println("Please Enter the Double Value");
d=Double.parseDouble(br.readLine());
System.out.println(" Integer Absolute Value =" +Math.abs(a));
System.out.println(" Float Absolute Value =" +Math.abs(b));
System.out.println(" Long Absolute Value =" +Math.abs(c));
System.out.println(" Double Absolute Value =" +Math.abs(d));
}
}
--------------------Output--------------------
Please Enter the Integer Value
-9
Please Enter the Float Value
-90.89
Please Enter the Long Value
-8987777
Please Enter the Double Value
-78.90888
Integer Absolute Value =9
Float Absolute Value =90.89
Long Absolute Value =8987777
Double Absolute Value =78.90888
Process completed.
No comments:
Post a Comment