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.
Tham khảo!
program baitap;
uses crt;
var a:integer;
procedure chanle(x:integer);
begin
if ((x mod 2) = 0) then write('So nhap vao la so chan.') else
write('So nhap vao la so le.');
end;
begin
clrscr;
write('Nhap a: ');readln(a);
chanle(a);
readln;
end
#include <bits/stdc++.h>
using namespace std;
long long n,a[1000],m,i;
bool kt;
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
cin>>m;
kt=false;
for (i=1; i<=n; i++)
if (a[i]==m) kt=true;
if (kt==true) cout<<"Co";
else cout<<"Khong";
return 0;
}
python.
N = input(nhap so nguyen N)
if n%2 == 0:
print('N la so chan')
else:
print('N la so le')
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
if (n%2!=0) cout<<"La so le";
else cout<<"Khong la so le";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
bool kt=true;
for (int i=2; i*i<=n; i++)
if (n%i==0) kt=false;
if (kt==true && n>=2) cout<<"YES";
else cout<<"NO";
return 0;
}
uses crt;
var i,n,s: integer;
a:array[1..100] of integer;
begin
writeln('Nhap n: '); read(n);
for i:=1 to n do
begin
write('a[',i,'] = '); readln(a[i]);
end;
writeln('Cac so le: ')
s:=0;
for i:=1 to n do
if a[i] mod 2 <> 0 then
begin
s:=s+a[i];
write(a[i],' ');
end;
writeln('- Tong so le: ',s);
for i:=1 to trunc(sqrt(s)) do if s mod i = 0 then d:=d+1;
if d > 1 then writeln('Tong do khong la so nguyen to') else writeln('Tong do la so nguyen to');
readln
end.
Bài 1:
uses crt;
var m,n,i,t:integer;
begin
clrscr;
write('Nhap m='); readln(m);
write('Nhap n='); readln(n);
t:=0;
for i:=m to n do
t:=t+i;
writeln(t);
readln;
end.
2:
uses crt;
var n:integer;
{---------------chuong-trinh-con-kiem-tra-chan-le---------------------}
function ktcl(x:integer):boolean;
begin
if x mod 2=0 then ktcl:=true
else ktcl:=false;
end;
{--------------------chuong-trinh-con-kiem-tra-duong-am-------------------}
fucntion ktda(x:integer):boolean;
begin
if x>0 then ktda:=true
else if x<0 then ktda:=false;
end;
{--------------------chuong-trinh-chinh-------------------------}
begin
clrscr;
write('Nhap n='); readln(n);
if ktcl(n)=true then writeln('Day la so chan')
else writeln('Day la so le');
if ktda(n)=true then writeln('Day la so duong')
else writeln('Day la so am');
readln;
end.
uses crt;
var m:integer;
begin
clrscr;
write('Nhap m='); readln(m);
if m mod 2=0 then writeln(m,' la so chan')
else writeln(m,' la so le');
writeln('Binh phuong cua ',m,' la: ',sqr(m));
writeln('Can bac hai cua ',m,' la: ',sqrt(m));
writeln('Gia tri tuyet doi cua ',m,' la: ',abs(m));
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
if (n%2==0) cout<<"La so chan";
else cout<<"La so le";
return 0;
}