daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest Oct 20th, 2018 70 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. import java.util.Scanner;
  2. class Lab3{
  3.     public static void main(String [] args){
  4.  
  5.             Scanner sc = new Scanner(System.in);
  6.  
  7.             int x;
  8.  
  9.             System.out.println("Please enter the value of x");
  10.  
  11.             x = sc.nextInt();
  12.  
  13.             double result;
  14.             result = (x*x*x-4*(x+20))/2.0;
  15.             System.out.println("F("+x+") = " + result);
  16.  
  17.             x = x - 1;
  18.             result = (x*x*x-4*(x+20))/2.0;
  19.             System.out.println("F("+x+") = " + result);
  20.  
  21.             x = x + 2 ;
  22.             result = (x*x*x-4*(x+20))/2.0;
  23.             System.out.println("F("+x+") = " + result);
  24.  
  25.             System.out.print("Thanks for using my program :)");
  26.         }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top