triangle area formula

double traingleArea  = base * height / 2; 

area of triangle

import java.util.Scanner;

public class shw2point15 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.println("Enter three points for a triangle:");

        double x1 = input.nextDouble();
        double y1 = input.nextDouble();
        double x2 = input.nextDouble();
        double y2 = input.nextDouble();
        double x3 = input.nextDouble();
        double y3 = input.nextDouble();


        double s = ((x1 + y1) + (x2 + y2) + (x3 + y3)) / 2;
        double area = Math.sqrt(s * (s - (x1 - y1)) * (s - (x2 - y2)) * (s - (x3 - y3)));



        System.out.println("The area of the triangle is " + area);
    }
}

Triangle area

 namespace TriangleCalc; 
 public class Program
 {
     private double A { get; set; }
     private double B { get; set; }
     private double C { get; set; }
     public void Triangle()
     {
         try
         {
             this.A = Convert.ToDouble(Console.ReadLine());
             Console.WriteLine("a is " + A);
             this.B = Convert.ToDouble(Console.ReadLine());
             Console.WriteLine("b is " + B);
             this.C = Convert.ToDouble(Console.ReadLine());
             Console.WriteLine("c is " + C);
         }  catch
         {
             throw (new Exception("Triangle's side must be a number"));
         }
     }
     
     public void Area()
     {
             if (A + B > C && B + C > A && A + C >B )  
             {
                 var s  = (A+B+C)/2;
                 var result = Math.Sqrt(s * (s - A) * (s - B) * (s - C));
                 Console.WriteLine("The area is " + result );
             }
             else
             {
                 Console.WriteLine("Result is NaN");
             }
     }
     
     public void Perimeter()
     {
         if (A + B > C && A + C > B && B + C > A)
         {
             var perimeter = A + B + C;
             Console.WriteLine("The perimeter is " + perimeter);
         }
         else
         {
             Console.WriteLine("Such triangle doesn't exist");
         }
     } 
 }

public class Runner : Program
{
    public static void Main(string[] args)
    {
        while (true)
        {
            Console.WriteLine("1-Start\n2-Stop");
            var input1 = Convert.ToInt32(Console.ReadLine());

            if (input1 == 1)
            {
                var startProgram = Triangleİtems.Start;
            }
            else
            {
                throw (new Exception("Program must start with 1"));
            }

            var triangle = new Program();
            triangle.Triangle();
            triangle.Area();
            triangle.Perimeter();

            Console.WriteLine("You can end program with 2");
            input1 = Convert.ToInt32(Console.ReadLine());

            if (input1 == 2)
            {
                var stopProgram = Triangleİtems.Stop;
            }

            else
            {
                throw (new Exception("Program must stop with 2"));
            }
        }
    }
}

public static class Triangleİtems
{
    public static DateTime Start;
    public static DateTime Stop;

    public static DateTime StartProgram()
    {
        Start = DateTime.Now;
        return Start;
    }

    public static DateTime StopProgram()
    {
        Stop = DateTime.Now;
        return Stop;
    }
}
Source: github.com

The area of a triangle

import java.util.Scanner;
class AreaOfTriangle3 
{
   public static void main(String args[]) 
    {   
       
      Scanner s1= new Scanner(System.in);
        
         System.out.println("Enter the 1st side:");
         int a= s1.nextInt();
 
         System.out.println("Enter the 2nd side:");
          int b= s1.nextInt();
 
         System.out.println("Enter the 3rd side:");
         int c= s1.nextInt();
        if((a+b)>c && (a+c)>b && (b+c)>a)
          {
            int s=(a+b+c)/2;
            double  area=Math.sqrt(s*(s-a)*(s-b)*(s-c));
             System.out.println("Area of Triangle is: " + area);    
           }
         else  
           System.out.println("Area of Triangle not exit");
   }
}

C#相关代码片段

stackpanel opacity mask from resources wpf

how to code

c# array isn't working

hydrogen fuels

generate parentheses

random class

reverse array

translator

stack over flow

prime number algorithm

palindrome

palindromes

rigidbody velocity

randomise array

shuffle array

fisher yates shuffle

prime numbers

generate prime numbers

rest api in c#

poisson distribution

ms transform

wetter warendorf

querstring fromat asp.net c#

null objects

skrivetænking

how to close a popup wpf c# on click event

Function delegate

next permutation

CullingGroup

händelsereportage

Delegates in UntiyC#

getcomponent

class combining

tee into file

reverse integer

how long dose it take for formate a currupt USB?

team fortress

card caption

math round to next integer c#

calculator

skrivetækning

remove element

class merging

dadar pincode

ASP.MVC display image from SqlServer

hive survive

c# delegates

wpf onpropertychanged not working

loop through dictionary

get the next letter after specific character in c#

how to make character respawn if touches sprite c#

snake spielen

mental retardation

palindrome number

download file

c# language

static variables

codegrepper

tomatch jest

linkedlist sorting

index sort

multidimensional meaning

Boolean Literals

Working with null values

samsung sam

dsharp emoji from string

print bitmap company logo c sharp

gersener waves

www.elking.net

active form

add rotation

texture matrix

ip address

delete directory

inheritance

uppercase letter

binary tree

assert throw

triangle area

ado stands for