编写一个控制台应用程序,输入三角形或者长方形边长,计算其周长和面积并输出. 代码: 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
package text1; import java.util.Scanner; public class text11 { public static void main(String[] args){ Scanner sc =new Scanner(System.in); System.out.print("输入圆的半径"); int a =sc.nextInt(); System.out.print("圆的周长是:"+a*2*3.14+"圆的面积是:
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