admin admin Author
Title: code kiểm tra tam giác
Author: admin
Rating 5 of 5 Des:
‪#‎include‬ <stdio.h> #include <onio.h> bool KiemTraTamGiac (int a, int b, int c) { if (a+b >c && b + c > a ...
‪#‎include‬ <stdio.h>
#include <onio.h>
bool KiemTraTamGiac (int a, int b, int c)
{
if (a+b >c && b + c > a && a +c >b)
return true;
return false;
}
void LoaiTamGiac (int a, int b, int c)
{
if (a*a + b*b == c*c || a*a + c*c == b*b || c*c + b*b == a*a)
{
printf ("\nDay la tam giac vuong ");
}
else printf ("\nDay la tam giac thuong");
}
int main ()
{
int a,b,c;
printf ("\nNhap do dai 3 canh cua tam giac : \n");
scanf ("%d%d%d",&a,&b,&c);
KiemTraTamGiac (a,b,c);
if (KiemTraTamGiac (a,b,c)== true)
{
LoaiTamGiac (a,b,c);
}
else 
printf ("\nDo dai 3 canh vua nhap khong phai la 3 canh cua mot tam giac");
getch ();
return 0;
}
Các bạn xem thêm đây để hiểu nhé:http://hocccoban.org/2015/03/21/code-kiem-tra-tam-giac.html

About Author

Advertisement

Post a Comment

 
Top