码迷,mamicode.com
首页 > 其他好文 > 详细

p95_3.3

时间:2018-10-17 00:16:04      阅读:102      评论:0      收藏:0      [点我收藏+]

标签:print   out   NPU   div   pre   scanner   put   system   can   

 1 import java.util.Scanner;
 2 public class LinearEquation {
 3     public static void main(String[] args){
 4         double a, b, c, d, e, f, x, y;
 5         System.out.println("Enter a,  b, c, d, e, f");
 6         Scanner input = new Scanner(System.in);
 7         a = input.nextDouble();
 8         b = input.nextDouble();
 9         c = input.nextDouble();
10         d = input.nextDouble();
11         e = input.nextDouble();
12         f = input.nextDouble();
13         if((a*d)-(b*c) == 0){
14             System.out.println("The equation has no solution");
15         }
16         else{
17         x=((e*d)-(b*f))/((a*d)-(b*c));
18         y=((a*f)-(e*c))/((a*d)-(b*c));
19         System.out.println("x is " + x + " and y is " + y);
20         }
21     }
22 }

 

p95_3.3

标签:print   out   NPU   div   pre   scanner   put   system   can   

原文地址:https://www.cnblogs.com/cherrydream/p/9801055.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!