def j(): a,b,c=map(float,input('请输入三角形三条边的长度,用空格隔开:').split()) if a>0 and b>0 and c>0 and a+b>c and a+c>b and b+c>a: l=a+b+c p=l/2 s=p*(p-a)*(p-b)*(p-c)#海伦公式 print('三角形的周长:{:.2f}\n三角形的面积:{:.2f}'.format(l,s)) else: print('三角形不成立,请重新输入') j
""" 已知三角形的边长求他的面积和周长 Author:罗万财 Date:2017-3-3 """ import math a=float(input('a=')) b=float(input('b=')) c=float(input('c=')) if a+b>c and a+c>b and b+c>a: d=a+b+c e=(a+b+c)/2 f=math.sqrt(e*(e-a)*(e-b)*(e-c)) print('三
编写一个控制台应用程序,输入三角形或者长方形边长,计算其周长和面积并输出. 代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Lab001 { class Program { static void Main(string[] args) { int i; int j=1; double
(一)改错题 输出三角形的面积和周长,输入三角形的三条边a.b.c,如果能构成一个三角形,输出面积area和周长perimeter(保留2位小数):否则,输出"These sides do not correspond to a valid triangle". 输入输出样例1: Enter 3 sides of the triangle: 5 5 3 area = 7.15: perimeter = 13.00 输入输出样例2: Enter 3 sides of the triang
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 排序 日期 题目地址:https://leetcode.com/problems/largest-perimeter-triangle/ 题目描述 Given an array A of positive lengths, return the largest perimeter of a triangle with non-zero area, f