C# P.Tannenbaum engage corners of the smallest length of the triangle

Posted: October 13, 2014 in Algorithms, C#
Tags: ,

P.Tannenbaum , kenarları a,b,c ve açıları 120 dereceden küçük olarak verilen bir üçgenin köşelerini birleştiren en kısa uzunluğu
aşağıdaki algoritmayla hesaplanacağını bulmuştur.

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

namespace ConsoleApplication17
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(“Lütfen a kenarını giriniz=”);
int x = int.Parse(Console.ReadLine());
Console.WriteLine(“Lütfen b kenarını giriniz=”);
int y = int.Parse(Console.ReadLine());
Console.WriteLine(“Lütfen c kenarını giriniz=”);
int z = int.Parse(Console.ReadLine());
double n = (x * x + y * y + z * z)/2;
double m = 2 * x * x * y * y + 2 * x * x * z * z + 2 * y * y * z * z – (x * x * x * x + y * y * y * y + z * z * z * z);
double k = Math.Sqrt(3)/2*Math.Sqrt(m);
double t = Math.Sqrt(n + k);

double deger = Math.Sqrt(t);
Console.WriteLine(“En kısa uzunluk = {0}”, deger);
Console.ReadKey();

}
}
}

—————————————————————————————————————————-

33

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s