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.
const
fi='lhcs.inp';
fo='lhcs.out';
a:array[0..9] of byte=(1,0,0,0,1,0,1,0,2,1);
var
f:text;
t,n:integer;
procedure inp;
begin
assign(F,fi);
reset(F);
read(f,n);
close(F);
end;
procedure out;
begin
assign(f,fo);
rewrite(F);
t:=0;
while n<>0 do
begin
t:= t+a[n mod 10];
n:= n div 10
end;
write(f,t);
close(F);
end;
BEGIN
INP;
OUT;
END.
const
fi='lohongcs.inp';
fo='lohongcs.out';
var
f:text;
i,s:integer;
n:longint;
a:array[0..9] of byte;
begin
assign(f,fi);
reset(f);
read(f,n);
for i:= 1 to n do
read(f,a[i]);
a[8]:=2;
a[0]:=1; a[4]:=1; a[6]:=1; a[9]:=1;
a[1]:=0; a[2]:=0; a[3]:=0; a[5]:=0; a[7]:=0;
close(F);
assign(f,fo);
rewrite(F);
s:=0;
repeat
i:=n mod 10;
s:=s+a[i];
n :=n div 10 ;
until n=0;
write(f,s);
close(F);
end.
const
nhap='bai1.inp';
xuat='bai1.out';
var n,m,u,d:int64;
begin
assign(input,nhap);reset(input);
assign(output,xuat);rewrite(output);
read(n);
while n<>0 do
begin
m:=n mod 10;
n:=n div 10;
if (m=1) or (m=2) or (m=3) or (m=5) or
(m=7) then d:=0;
if (m=0) or (m=4) or (m=6) or (m=9)
then d:=1;
if m=8 then d:=2;
u:=u+d;
end;
writeln(u);
close(input);close(output);
end.
uses crt;
var n,d,dem,i,x,y,t:integer;
st:string;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (1000<=n) and (n<=9999);
if n mod 2=0 then
begin
str(n,st);
d:=length(st);
dem:=0;
for i:=1 to d do
begin
val(st[i],x,y);
if x=0 then inc(em);
end;
writeln('So chu so 0 co trong so ',n,' la: ',dem);
end
else begin
str(n,st);
t:=0;
d:=length(st);
for i:=1 to d do
begin
val(st[i],x,y);
t:=t+sqr(x);
end;
writeln('Tong binh phuong cac chu so trong so ',n,' la: ',t);
end;
readln;
end.
uses crt;
var n,d,dem,i,x,y,t:integer;
st:string;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (1000<=n) and (n<=9999);
if n mod 2=0 then
begin
str(n,st);
d:=length(st);
dem:=0;
for i:=1 to d do
begin
val(st[i],x,y);
if x=0 then inc(em);
end;
writeln('So chu so 0 co trong so ',n,' la: ',dem);
end
else begin
str(n,st);
t:=0;
d:=length(st);
for i:=1 to d do
begin
val(st[i],x,y);
t:=t+sqr(x);
end;
writeln('Tong binh phuong cac chu so trong so ',n,' la: ',t);
end;
readln;
end.
program hoc24;
n: string[20];
k,i,t,d,d1: byte;
code: integer;
begin
write('Nhap so K: '); readln(k);
write('Nhap so nguyen N: '); readln(n);
d:=0; d1:=0;
for i:=1 to k do
begin
val(n[i],t,code);
if t mod 2=0 then d:=d+1 else d1:=d1+1;
end;
writeln('Co ',d,' chu so chan');
write('Co ',d1,' chu so le');
readln
end.
const fi='docao13.inp';
fo='docao13.out';
var f1,f2:text;
a:array[1..100]of integer;
i,n:integer;
//chuongtrinhcon
function kq(x:integer):integer;
var t,k:integer;
begin
t:=0;
while (x>0) do
begin
k:=x mod 10;
t:=t+k;
x:=x div 10;
end;
kq:=t;
end;
//chuongtrinhchinh
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
for i:=1 to n do
write(f2,kq(a[i]):4);
close(f1);
close(f2);
end.
rồi câu hỏi chỗ nào v ?