Advertisement
Waliullah8328

Some Equation Solve

Jan 27th, 2021
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5.  
  6.  
  7. public class Question1
  8. {
  9.     public static int equation1(int A,int B,int C,int D)
  10.     {
  11.         int result;
  12.         result = (A * B - C * D);
  13.  
  14.         return result;
  15.  
  16.     }
  17.  
  18.     public static int equation2(int A,int B,int D)
  19.     {
  20.        
  21.        int result2 = (((2*A) - (B)) + (3*D));
  22.  
  23.  
  24.         int result21 = result2;
  25.         return result21;
  26.  
  27.     }
  28.  
  29.     public static int equation3(int A,int B,int C,int D)
  30.     {
  31.  
  32.         int result3 =   A*A + B*B - C*C + D*D;
  33.  
  34.  
  35.         int result31 = result3;
  36.         return result31;
  37.  
  38.     }
  39.  
  40.     public static int equation4(int A,int B,int C)
  41.     {
  42.  
  43.         int result4 =   A*A*A + B -C*C;
  44.  
  45.  
  46.         int result31 = result4;
  47.         return result31;
  48.  
  49.     }
  50.  
  51.     public static void main(String[] args)
  52.     {
  53.        Scanner input = new Scanner(System.in);
  54.        int a,b,c,d;
  55.         System.out.print("Enter A = ");
  56.         a =input.nextInt();
  57.  
  58.         System.out.print("Enter B = ");
  59.         b =input.nextInt();
  60.  
  61.         System.out.print("Enter C = ");
  62.         c =input.nextInt();
  63.  
  64.         System.out.print("Enter D = ");
  65.         d =input.nextInt();
  66.         int result2 = equation1(a,b,c,d);
  67.         System.out.println("Solution of Equation - 1 =  " +result2);
  68.  
  69.         int result3 = equation2(a,b,d);
  70.         System.out.println("Solution of Equation - 2 =  " +result3);
  71.  
  72.         int result4 = equation3(a,b,c,d);
  73.         System.out.println("Solution of Equation - 2 =  " +result4);
  74.  
  75.         int result5 = equation4(a,b,c);
  76.         System.out.println("Solution of Equation - 2 =  " +result5);
  77.  
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement