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.
1:
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
writeln(t);
readln;
end.
3:
const fi='dl.txt';
fo='kq.txt';
var f1,f2:text;
a:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a);
writeln(f2,a);
close(f1);
close(f2);
end.
Uses crt;
Var i:integer;
s1,s2:string;
Begin
clrscr;
Writeln('Nhap xau:');readln(s1);
s2:='';
i:=length(s1);
While s1[i]<> ' ' do
Begin
s2:=s2+s1[i];
i:=i-1;
End;
Writeln('Tu sau cung cua xau la:');
For i:=length(s2) downto 1 do write(s2[i]);
readln;
End.
uses crt;
var st,s:string;
i,d:integer;
begin
clrscr;
readln(st);
d:=length(st);
s:='';
i:=d;
while st[i]<>#32 do
begin
s:=s+st[i];
i:=i-1;
end;
for i:=length(s) downto 1 do
write(s[i]);
readln;
end.
uses crt;
var st:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
dem:=0;
for i:=1 to d do
if st[i]=#32 then inc(dem);
writeln(dem);
readln;
end.
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
readln(st);
d:=length(st);
for i:=1 to d do
begin
if st[i]=' ' then writeln
else write(st[i]);
end;
readln;
end.
Chương trình:
program bai_10_chuong_4;
uses crt;
var
s: string[100];
i, dem: integer;
Begin
clrscr;
write('Nhap xau vao:'); readln(s); dem:= 0;
for i:= 1 to length(s) do
if ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+l;
Writeln('Trong xau s co '»dem,' chu so thap phan');
readln;
End.
uses crt;
var st:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
writeln('Xau vua nhap la: ',st);
dem:=0;
for i:=1 to d do
if st[i] in ['0'..'9'] then inc(dem);
writeln(dem);
readln;
end.
Tk:
uses crt;
var st:string;
i,d,t,x,y:integer;
begin
clrscr;
readln(st);
d:=length(st);
t:=0;
for i:=1 to d do
if (st[i] in ['0'..'9']) then
begin
val(st[i],x,y);
t:=t+x;
end;
writeln(t);
readln;
end.