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='input.txt';
fo='output.txt';
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 eof(f1) do
begin
inc(n);
read(f1,a[n]);
end;
t:=0;
for i:=1 to n do t:=t+a[i];
write(f2,t);
close(f1);
close(f2);
end.
Bài 1:
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
a,b,s:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b);
s:=a*b;
writeln(f2,s);
close(f1);
close(f2);
end.
Bài 2:
const fi='dulieu.txt';
fo='ketqua.txt';
var f1,f2:text;
a,b:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b);
if a>b then writeln(f2,a)
else if b>a then writeln(f2,b)
else writeln(f2,' khong co so lon nhat trong hai so');
close(f1);
close(f2);
end.
Program HOC24;
const fi='inp.txt';
fo='output.txt';
var f: text;
a: array[1..32000] of integer;
i,n,d: integer;
procedure ip;
begin
assign(f,fi);
reset(f);
n:=0;
while not(eof(f)) do
begin
n:=n+1;
read(f,a[n]);
end;
close(f);
end;
procedure out;
begin
assign(f,fo);
rewrite(f);
d:=0;
for i:=1 to n do if a[i]<0 then d:=d+1;;
write(f,d);
close(f);
end;
begin
ip;
out;
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b,c,d;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
cin>>a>>b>>c>>d;
cout<<a+b+c+d;
return 0;
}
uses crt;
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
a,b:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a,b);
if (a=0) and (b=0) then writeln(f2,'Phuong trinh co vo so nghiem');
if (a<>0) then writeln(f2,-b/a:4:2);
if (a=0) and (b<>0) then writeln(f2,'Phuong trinh vo nghiem');
close(f1);
close(f2);
end.
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
a:array[1..100]of integer;
n,i,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]<0 then inc(dem);
writeln(f2,dem);
close(f1);
close(f2);
end.
const fi='input.txt';
fo='output.txt';
var f1,f2:text;
n,i,dem:integer;
a:array[1..100]of integer;
{------------------------chuong-trinh-con-1----------------------------}
procedure docfile;
begin
assign(f1,fi); reset(f1);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
close(f1);
end;
{------------------------chuong-trinh-con-2----------------------------}
procedure xuatfile;
begin
assign(f2,fo); rewrite(f2);
dem:=0;
for i:=1 to n do
if a[i] mod 5=0 then inc(dem);
writeln(f2,dem);
close(f2);
end;
{-------------------------chuong-trinh-chinh-------------------------}
begin
docfile;
xuatfile;
end.