Skip to content

Instantly share code, notes, and snippets.

@TranNgocMinh
Last active February 5, 2018 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TranNgocMinh/b93f51680738da73c0b0f4d2b82d7c61 to your computer and use it in GitHub Desktop.
Save TranNgocMinh/b93f51680738da73c0b0f4d2b82d7c61 to your computer and use it in GitHub Desktop.
bool isTriangle = true;
char OK = 'Y';
float a,b,c;
do
{
Console.WriteLine("Nhap a = ");
a = float.Parse(Console.ReadLine());
Console.WriteLine("Nhap b = ");
b = float.Parse(Console.ReadLine());
Console.WriteLine("Nhap c = ");
c = float.Parse(Console.ReadLine());
if(a<=0 || b<=0 || c<=0)
isTriangle = false;
if((a + b <= c) || (a + c <= b) || (b + c <= a))
isTriangle = false;
if(isTriangle)
Console.WriteLine("Day la tam giac");
else
Console.WriteLine("Day khong phai la tam giac");
isTriangle = true;
Console.WriteLine("Ban muon tiep tuc khong?(Y/N)");
OK = Console.ReadKey().KeyChar;
} while(OK != 'N');
Console.ReadKey();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment