DenchikNO

the roots

Oct 10th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. public class Main {
  2.  
  3.     public static void main(String[] args) {
  4.  
  5.         System.out.println("Квадратное уравнение: x^2+7x+10=0");
  6.  
  7.         int d;
  8.         int b=7;
  9.         int a=1;
  10.         int c=10;
  11.         double x1;
  12.         double x2;
  13.  
  14.         d = b*b - 4 * a * c;
  15.  
  16.         x1 = (-b + Math.sqrt(d))/2;
  17.         x2 = (-b - Math.sqrt(d))/2;
  18.  
  19.         System.out.println("Его корни: "+x1+" "+x2);
  20.     }
  21. }
Add Comment
Please, Sign In to add comment