第三章第十九题(计算三角形的周长)(Compute the perimeter of a triangle)

这篇博客介绍了如何用Java编写一个程序,该程序读取三角形的三条边,根据输入值是否满足任意两条边之和大于第三边的条件来判断输入是否有效,并计算周长。强调了代码规范,包括文件名使用英文,注释和变量命名的具体性,以及代码风格的一致性。
摘要由CSDN通过智能技术生成

**3.19(计算三角形的周长)编写程序,读取三角形的三条边,如果输入值合法就计算这个三角形的周长;否则,显示这些输入值不合法。如果任意两条边的和大于第三边,那么输入值都是合法的。

**3.19(Compute the perimeter of a triangle)(Compute the perimeter of a triangle) Write a program that reads three edges for a triangle and computes the perimeter if the input is valid. Otherwise, display that the input is invalid. The input is valid if the sum of every pair of two edges is greater than the remaining edge.

下面是参考答案代码:

import java.util.*;

public class ComputePerimeterTriangleQuestion19 {
   
	public static
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值