
Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.


Bài 3:
uses crt;
var i:integer;
{------------------chuong-trinh-con-kiem-tra-so-nguyen-to----------------------}
function ktnt(x:integer):boolean;
var kt:boolean;
i:integer;
begin
kt:=true;
for i:=2 to x-1 do
if x mod i=0 then kt:=false;
if kt=true then ktnt:=true
else ktnt:=false;
end;
{-------------------------chuong-trinh-chinh----------------------------}
begin
clrscr;
for i:=2 to 9999 do
if (ktnt(i)=true) and (ktnt(i+2)=true) then
begin
writeln(i,',',i+2);
delay(500);
end;
readln;
end.
Bài 4:
uses crt;
var a,b,c,kt:integer;
begin
clrscr;
write('Nhap ngay:'); readln(a);
write('Nhap thang:'); readln(b);
write('Nhap nam:'); readln(c);
kt:=0;
if (b=1) and (0<a) and (a<=31) then kt:=1;
if (b=2) and (0<a) and (a<=28) then kt:=1;
if (b=2) and (0<a) and (a<=29) and (c mod 4=0) then kt:=1;
if (b=3) and (0<a) and (a<=31) then kt:=1;
if (b=4) and (0<a) and (a<=30) then kt:=1;
if (b=5) and (0<a) and (a<=31) then kt:=1;
if (b=6) and (0<a) and (a<=30) then kt:=1;
if (b=7) and (0<a) and (a<=31) then kt:=1;
if (b=8) and (0<a) and (a<=31) then kt:=1;
if (b=9) and (0<a) and (a<=30) then kt:=1;
if (b=10) and (0<a) and (a<=31) then kt:=1;
if (b=11) and (0<a) and (a<=30) then kt:=1;
if (b=12) and (0<a) and (a<=31) then kt:=1;
if kt=0 then writeln('Khong hop le')
else writeln('Hop le');
readln;
end.

2:
#include <bits/stdc++.h>
using namespace std;
double xm,ix,iy,r,ma,mb;
int main()
{
cin>>ix>>iy;
cin>>r;
cin>>ma>>mb;
xm=sqrt((ix-ma)*(ix-ma)+(iy-mb)*(iy-mb));
if (xm==r) cout<<"phai";
else cout<<"khong phai";
return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
long a,b,x,dem,i;
cout<<"a="; cin>>a;
cout<<"b="; cin>>b;
cout<<"x="; cin>>x;
dem=0;
for (i=a; i<=b; i++)
if (i%x==0) dem++;
cout<<dem;
return 0;
}
Lời giải :
program hotrotinhoc;
var x,y,x1: integer;
begin
readln(x);
x1:=x;
readln(y);
x:=y;
y:=x1;
write('Sau khi hoan doi: x=',x,', y= ',y);
readln
end.