Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class Lab3{
- public static void main(String [] args){
- Scanner sc = new Scanner(System.in);
- int x;
- System.out.println("Please enter the value of x");
- x = sc.nextInt();
- double result;
- result = (x*x*x-4*(x+20))/2.0;
- System.out.println("F("+x+") = " + result);
- x = x - 1;
- result = (x*x*x-4*(x+20))/2.0;
- System.out.println("F("+x+") = " + result);
- x = x + 2 ;
- result = (x*x*x-4*(x+20))/2.0;
- System.out.println("F("+x+") = " + result);
- System.out.print("Thanks for using my program :)");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement