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='songuyen.inp';
fo='tong.out';
var f1,f2:text;
a:array[1..100]of integer;
i,n,t:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eoln(f1) do
begin
n:=n+1;
read(f1,a[n]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then t:=t+a[i];
writeln(f2,t);
close(f1);
close(f2);
end.
const fi='input.txt';
fo='chiahet.txt';
var f1,f2:text;
a:array[1..100]of integer;
i,n,dem:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eoln(f1) do
begin
inc(n);
read(f1,a[n]);
end;
dem:=0;
for i:=1 to n do
if a[i] mod 3=0 then inc(dem);
writeln(f2,dem);
close(f1);
close(f2);
end.
uses crt;
const fo='b.txt';
var f1:text;
a:array[1..200]of integer;
i,n:integer;
begin
clrscr;
assign(f1,fo); rewrite(f2);
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
write(f1,a[i]:4);
close(f1);
readln;
end.
program cap_so_cong;
uses crt; var a: array[1..100] of integer; i, n, k: integer;
{i la bien dem, k de luu cap so} begin clrscr; write('N= ');
readln(n); for i:=1 to n do begin write('A(',i,')= ');
readln(a[i]);
end;
{Bat dau phan kiem tra} k:=a[2]-a[1]; i:=2; repeat i:= i+1; until (a[i]<>a[i-1]+k) or (i>n);
if i>n then write('Day A la mot cap so cong') else
write('Day A khong phai la mot cap so cong');
readln
end.
uses crt;
const fi='ketqua.out';
var f1:text;
a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
writeln(f1,min);
close(f1);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,nn;
int main()
{
freopen("dulieuvao.txt","r",stdin);
freopen("dulieura.txt","w",stdout);
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
nn=a[1];
for (i=2; i<=n; i++) nn=min(nn,a[i]);
cout<<nn;
return 0;
}
Program HOC24;
var i,n: integer;
a: array[1..1000] of integer;
t: longint;
f1,f2: text;
const fi='DATA1.TXT';
fo='KQ1.TXT';
begin
assign(f1,fi);
assign(f2,fo);
reset(f1);
rewrite(f2);
readln(f1,n);
for i:=1 to n do read(f1,a[i]);
t:=0;
for i:=1 to n do if a[i] mod 2=0 then t:=t+a[i];
writeln(f2,t);
for i:=1 to n do if a[i] mod 5=0 then write(f2,a[i],' ');
close(f1); close(f2);
end.
Câu 1:
uses crt;
const fi='tinhoc11.out';
var a:array[1..49]of integer;
n,i:integer;
f1:text;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
write(f1,a[i]:4);
close(f1);
readln;
end.
Câu 2:
const fi='dayso.pas';
fo='baitap.pas';
var a:array[1..100]of integer;
n,i,dem:integer;
f1,f2:text;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eoln(f1) do
begin
inc(n);
read(f1,a[n]);
end;
dem:=0;
for i:=1 to n do
if a[i] mod 4=0 then inc(dem);
writeln(f2,dem);
close(f1);
close(f2);
end.