mjn1

任务描述

本关任务:编程求以a、b、c为边长的三角形的面积area

提示:

三角形面积计算公式为:

假设三角形三条边长分别为abc,其中,则面积

输入

a b c三角形的三条边,可以是小数。

输出

三角形面积,保留3位小数。

样例输入

3

4

5

样例输出

三角形面积s=6.000


开始你的任务吧,祝你成功!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ch204
{
    class Program
    {
        static void Main(string[] args)
        {
			/******begin*******/
			double a, b, c, s, area;
            a = Convert.ToInt32(Console.ReadLine());
            b = Convert.ToInt32(Console.ReadLine());
            c = Convert.ToInt32(Console.ReadLine());
            s = (a + b + c) / 2;
            area = Math.Sqrt(s * (s - a) * (s - b) * (s - c));
            Console.WriteLine("s={0}", area);
			
			
			/*******end********/

        }
    }
}

  

分类:

技术点:

相关文章:

  • 2021-07-09
  • 2021-12-19
  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
猜你喜欢
  • 2022-02-12
  • 2021-10-26
  • 2021-10-29
  • 2021-12-26
  • 2021-12-19
相关资源
相似解决方案