Giúp em với mn chương trình Pascal ạ
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 i,n:integer;
s:real;
begin
clrscr;
n:=1;
s:=0;
while (n<=10000) do
begin
n:=n+2;
s:=s+1/n;
end;
writeln(s:4:2);
readln;
end.
Program HOC24;
var st,st1,st2: string;
i,n,d,k,j: integer;
t,m: longint;
a: array[1..10000] of integer;
f: text;
const fi='SUBSUM.INP' ;
fo = 'SUBSUM.OUT' ;
Procedure ip;
begin
assign(f,fi);
reset(f);
readln(f,n,m);
for i:=1 to n do read(f,a[i]);
close(f);
end;
Procedure out;
begin
assign(f,fo);
rewrite(f);
d:=0;
for i:=1 to n-1 do
Begin
If a[i]=m then d:=d+1;
for j:=i+1 to n do
begin
t:=0;
for k:=i to j do t:=t+a[k];
if t=m then d:=d+1;
end;
End;
if a[n]=m then d:=d+1; write(f,d);
close(f);
end;
Begin
ip;
out;
End.
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
t:=t+a[i];
writeln(t);
readln;
end.
Var a:array[1..100] of integer;
i,s:integer;
Begin
For i:=1 to 100 do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
If a[i] mod 2 <> 0 then s:=s+a[i];
End;
Write('Tong la ',s);
Readln;
End.
Program HOC24;
var st,st1,st2: string;
i: byte;
f: text;
const fi='SPLIT.INP ' ;
fo = 'SPLIT.OUT' ;
Procedure ip;
begin
assign(f,fi);
reset(f);a
read(f,st);
close(f);
end;
Procedure out;
begin
assign(f,fo);
rewrite(f);
st1:=''; st2:='';
for i:=1 to length(st) do
begin
if st[i] in ['A'..'z'] then st1:=st1+st[i];
if st[i] in ['0'..'9'] then st2:=st2+st[i];
end;
writeln(f,st1);
write(f,st2);
close(f);
end;
Begin
ip;
out;
End.
Tham khảo:
program oken;
uses crt;
var i,n:integer;
begin
clrscr;
write('nhap 1 so bat ky: '); readln(n);
writeln('BANG CUU CHUONG ',n);
for i:=1 to 9 do
writeln(n,' * ',i,' = ',n*i);
readln;
end.
uses crt;
var a,b:int64;
begin
clrscr;
readln(a,b);
writeln(a*a+b*b);
readln;
end.