Create a program that will accept a decimal value,and display the integer values lying next to and before it.

import java.io.*;
public class Max
{
    public static void main(String args[])throws IOException
	{ 
	   double num,next,last;
	   InputStreamReader obj=new InputStreamReader(System.in);
	   BufferedReader objectBR=new BufferedReader(obj);
	   System.out.printIn("Please enter the decimal value");
	   String n1=objectBR.readLine();
	   num=double.parseDouble(n1);
	   next=Math.ceil(num);
	   last=Math.floor(num);
	   System.out.printIn('\f');
	   System.out.printIn("Entered number is:"+num);
	   System.out.printIn("Next value with respect to the entered number is:"+next);
	   System.out.printIn("Last value with respect to the entered number is:"+last);
	}
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Show Buttons
Hide Buttons