دریافت سه عدد از ورودی به عنوان ضلع های مثلث و بررسی اینکه آیا این سه عدد یک مثلث تشکیل میدهد یا نه ؟
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _02___Triangle_Edge
{
class Program
{
static void Main(string[] args)
{
double a, b, c;
Console.WriteLine(" Please enter 3 numbers : ");
a = Convert.ToDouble(Console.ReadLine());
b = Convert.ToDouble(Console.ReadLine());
c = Convert.ToDouble(Console.ReadLine());
if (a + b > c && a + c > b && b + c > a)
Console.WriteLine(" {0} , {1} , {2} : could be side of a Triangle ", a, b, c);
else
Console.WriteLine(" {0} , {1} , {2} : could //NOT// be side of a Triangle ", a, b, c);
Console.ReadKey();
//shmp30
}
}
}
علاقه مندی ها (بوک مارک ها)