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.
uses crt;
var st:string;
d,i,n:integer;
begin
clrscr;
readln(n);
str(n,st);
d:=length(st);
for i:=d downto 1 do
write(st[i]);
readln;
end.
uses crt;
var a:array[1..100]of integer;
n,dem,i,j:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n do
begin
dem:=0;
for j:=1 to a[i] do
if a[i] mod j=0 then inc(dem);
if dem mod 2=0 then write('0 ')
else write('1 ');
end;
readln;
end.
uses crt;
var a,b,c:array[1..1000]of integer;
i,n,dem,max:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
for i:=1 to n do
if max=a[i] then
begin
inc(dem);
b[dem]:=a[i];
c[dem]:=i;
end;
if dem=1 then writeln('So lon nhat la: ',b[dem],' vi tri la: ',c[dem])
else writeln('So lon nhat la: ',b[1],' vi tri la: ',c[1]);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i;
bool kt;
int main()
{
cin>>n;
kt=true;
for (i=2; i*i<=n; i++)
if (n%i==0) kt=false;
if ((kt==true) and (n>1)) cout<<"YES";
else cout<<"NO";
return 0;
}
const fi='tong.inp';
fo='tong.out';
var f1,f2:text;
a:array[1..100]of integer;
n,i,t:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(f2,t);
close(f1);
close(f2);
end.
program tim_nguon_nho_nhat;
const
MAX_NUMBER = 10000;
var
M, nguon_nho_nhat: Integer;
function TinhTongChuSo(num: Integer): Integer;
var
sumOfDigits: Integer;
begin
sumOfDigits := 0;
while num > 0 do
begin
sumOfDigits := sumOfDigits + (num mod 10);
num := num div 10;
end;
TinhTongChuSo := sumOfDigits;
end;
function TimNguonNhoNhat(M: Integer): Integer;
var
N, M_temp, M_digits, nguon_nho_nhat: Integer;
begin
M_temp := M;
nguon_nho_nhat := MAX_NUMBER;
for N := 1 to M_temp do
begin
M_digits := TinhTongChuSo(N) + N;
if M_digits = M_temp then
begin
if N < nguon_nho_nhat then
nguon_nho_nhat := N;
end;
end;
if nguon_nho_nhat = MAX_NUMBER then
TimNguonNhoNhat := 0
else
TimNguonNhoNhat := nguon_nho_nhat;
end;
begin
Readln(M);
nguon_nho_nhat := TimNguonNhoNhat(M);
if nguon_nho_nhat = 0 then
Writeln('0')
else
Writeln('Nguon nho nhat cua ', M, ' la ', nguon_nho_nhat);
end.