Bài 1:
---
Program BTT;
Uses crt;
Var a,b: longint;
Begin
Clrscr;
Write('Nhap a, b:' ); Readln(a,b);
If a>b then Write(a,' lon hon ',b)
Else If a<b then Write(b,' lon hon ',a)
Else Write('Bang nhau');
Readln
End.
---
Bài 2:
---
Program BTT;
Uses crt;
Var a,b,c: longint;
Begin
Clrscr;
Write('Nhap do dai 3 canh: ' ); Readln(a,b,c);
If (a+b>c) and (b+c>a) and (a+c>b) then Write('Do la do dai 3 canh cua tam giac')
Else Write('Do khong phai do dai 3 canh cua tam giac');
Readln
End.
---
Bài 3:
---
Program BTT;
Uses crt;
Var a,b: longint;
Begin
Clrscr;
Write('Nhap a, b: '); Readln(a,b);
If (a mod 2 = 1) and (b mod 2 = 1) then Write('Tong la: ',a+b)
Else If (a mod 2 = 0) and (b mod 2 = 0) then Write('Tich la: ',a*b)
Else Write('Khong dung yeu cau de');
Readln
End.
---
Bài 4:
---
Program BTT;
Uses crt;
Var a: longint;
Begin
Clrscr;
Write('Nhap a: '); Readln(a);
If (a mod 2 = 0) and (a mod 5 = 0) then Write(a,' chia het cho 2 va 5')
Else Write(a,' khong chia het cho 2 va 5');
Readln
End.
---
Bài 5:
---
Program BTT;
Uses crt;
Var a,s: byte;
Begin
Clrscr;
Write('Nhap a: '); Readln(a);
s:=a mod 10 + a div 10;
Write('Tong la: ',s);
Readln
End.
---