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;
const fo='data.txt';
var f1:text;
a:array[1..10]of integer;
i,n:integer;
begin
clrscr;
assign(f1,fo); rewrite(f1);
n:=10;
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(f1,a[i]:4);
close(f1);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[10],b[10],i,j;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
for (i=1; i<=10; i++) cin>>a[i];
for (j=1; j<=10; j++) cin>>b[j];
for (i=1; i<=10; i++)
cout<<a[i]+b[i]<<" ";
return 0;
}
Program HOC24;
var i,n: integer;
c: array[1..1000] of integer;
f: text;
begin
assign(f,'MANG3.TXT');
reset(f);
readln(f,n);
for i:=1 to n do read(f,c[i]);
close(f);
for i:=1 to n do if c[i] mod 2=1 then write(c[i],' ');
readln
end.
cau 1:
uses crt;
var a:array[1..100] of integer;
n,i,min: integer;
begin
readln(n);
for i:=1 to n do
readln(a[i]);
min:=a[1];
for i:=2 to n do
if min>a[i] then min=a[i];
writeln(a[i]);
readln;
end.
cau 2:
uses crt;
g:text;
s:string;
const fo='CHUSO.TXT';
begin
assign(g,fo);
rewrite(g);
readln(s);
for i:=1 to length(s) do
if not((s[i] in ['a'..'z'])and(s[i] in ['A'..'Z])) then delete(s,i,1);
writeln(g,s);
end.
#include <bits/stdc++.h>
using namespace std;
long long a[10000],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
t=0;
for (i=1; i<=n; i++) if (a[i]%2==0) t+=a[i];
cout<<"Tong cac so chan la: "<<t<<endl;
sort(a+1,a+n+1);
cout<<"Day so giam dan la: ";
for (i=n; i>=1; i--) cout<<a[i]<<" ";
return 0;
}
Câu 1:
const fi1='nguyen1.inp';
fi2='nguyen2.inp';
fo='songuyen.inp';
var f1,f2,f3:text;
a:array[1..10000]of integer;
i,dem:integer;
begin
assign(f1,fi1); reset(f1);
assign(f2,fi2); reset(f2);
assign(f3,fo); rewrite(f3);
dem:=0;
while not eof(f1) do
begin
inc(dem);
read(f1,a[dem]);
end;
while not eof(f2) do
begin
inc(dem);
read(f2,a[dem]);
end;
for i:=1 to dem do
write(f3,a[i]:4);
close(f1);
close(f2);
close(f3);
end.
Câu 2:
uses crt;
const fi='vanban.txt';
var f1:text;
st:array[1..255]of string;
dem:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
dem:=0;
while not eof(f1) do
begin
inc(dem);
readln(f1,st[dem]);
end;
writeln('So dong cua tep ',fi,' la: ',dem);
close(f1);
readln;
end.
Câu 3:
const fi='nguon.txt';
fo='dich.txt';
var f1,f2:text;
st:array[1..255]of string;
i,dem:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
dem:=0;
while not eof(f1) do
begin
inc(dem);
readln(f1,st[dem]);
end;
for i:=1 to dem do
writeln(f2,st[i]:4);
close(f1);
close(f2);
end.
Câu 4:
const fi='dulieu.int';
fo='sochan.out';
var f1,f2:text;
a:array[1..255]of integer;
i,dem:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
dem:=0;
while not eoln(f1)do
begin
inc(dem);
read(f1,a[dem]);
end;
for i:=1 to dem do
if a[i] mod 2=0 then write(f2,a[i]:4);
close(f1);
close(f2);
end.
Câu 5:
const fi='dulieu.int';
fo='dulieu.out';
var f1,f2:text;
a:array[1..255]of integer;
i,n,tam,j:integer;
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-1 do
for j:=i+1 to n do
if a[i]<a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
for i:=1 to n do
write(f2,a[i]:4);
close(f1);
close(f2);
end.