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

HW3.3

时间:2016-08-09 13:31:07      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

技术分享

 

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

 

HW3.3

标签:

原文地址:http://www.cnblogs.com/wood-python/p/5752780.html

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