第三章第三题(代数:求解2 * 2线性方程)(Algebra: solve 2 * 2 linear equations)

第三章第三题(代数:求解2 * 2线性方程)(Algebra: solve 2 * 2 linear equations)

  • *3.3(代数:求解2 * 2线性方程)可以使用编程练习题1.13中给出的Cramer规则解线性方程组:
    在这里插入图片描述

    编写程序,提示用户输入a, b, c, d, e 和 f,然后显示结果。如果 ad - bc为0,则报告消息 “The equation has no solution”(方程式无解)。
    这里有些运行示例:

    Here are some simple runs:

    Enter a, b, c, d, e, f:9.0 4.0 3.0 -5.0 -6.0 -21.0

    x is -2.0 and y is 3.0

    Enter a, b, c, d, e, f:1.0 2.0 2.0 4.0 4.0 5.0

    The equation has no solution

    *3.3(Algebra: solve 2 * 2 linear equations) A linear equation can be solved using Cramer’s rule given in Programming Exercise 1.13.
    在这里插入图片描述
    Write a program that prompts the user to enter a, b, c, d, e and f and displays the result. If ad - bc is 0, report that “The equation has no solution.”
    Here are some simple runs:

    Enter a, b, c, d, e, f:9.0 4.0 3.0 -5.0 -6.0 -21.0

    x is -2.0 and y is 3.0

    Enter a, b, c, d, e, f:1.0 2.0 2.0 4.0 4.0 5.0

    The equation has no solution

  • 参考代码:

package chapter03;

import 
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值