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.
Câu 3:
Program hotrotinhoc_hoc24;
const fi='dulieu.dat';
fo='dtb.dat';
var a,b,c,d: integer;
procedure ip;
begin
assign(f,fi);
reset(f);
readln(f,a,b);
read(f,c,d);
close(f);
end;
procedure out;
begin
assign(f,fo);
rewrite(f);
write(f,(a+b+c+d)/4:1:2);
close(f);
end;
begin
ip;
out;
end.
const fo='int.txt';
fo='out.txt';
var f1,f2:text;
m,n:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,m);
readln(f1,n);
writeln(f2,m+n);
close(f1);
close(f2);
end.
uses crt;
const fi='dulieu.dat';
var f1:text;
a,b,p,s:array[1..100]of real;
i,n:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(a[n],b[n]);
end;
for i:=1 to n do
begin
p[i]:=(a[i]+b[i])/2;
s[i]:=a[i]*b[i];
end;
for i:=1 to n do
writeln(p[i]:4:2,' ',s[i]:4:2);
close(f1);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,j;
bool kt;
int main()
{
freopen("nguyento.inp","r",stdin);
freopen("nguyento.out","w",stdout);
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]>1)
{
kt=true;
for (j=2; j*j<=a[i]; j++)
if (a[i]%j==0) kt=false;
if (kt==true) cout<<a[i]<<" ";
}
return 0;
}
mình ghi dư cái số 4 bên phần BAI7.INP nha mn
Câu 1:
uses crt;
const fi='nguon.txt';
var f1:text;
a,b,c:integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
assign(f1,fi); rewrite(f1);
writeln(f1,a);
writeln(f1,b);
writeln(f1,c);
close(f1);
readln;
end.
Câu 2:
const fi='nguon.txt';
fo='kq.txt';
var f1,f2:text;
a,b,c,max,min:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a);
readln(f1,b);
readln(f1,c);
writeln(f2,(a+b+c)/3:4:2);
max:=a;
if max<b then max:=b;
if max<c then max:=c;
writeln(f2,max);
min:=a;
if min>b then min:=b;
if min>c then min:=c;
writeln(f2,min);
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i;
int main()
{
freopen("so.inp","r",stdin);
freopen("so.out","w",stdout);
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]%2==0) cout<<a[i]<<" ";
return 0;
}
uses crt;
const fi='dst.txt';
var f1:text;
a,b:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,a);
readln(f1,b);
writeln('Tong cua hai so la: ',a+b);
writeln('Gia tri tuyet doi hieu hai so la: ',abs(a-b));
readln;
end.
const fi='dulieu.dat';
fo='tb.dat';
var f1,f2:text;
a,b:real;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,a);
readln(f1,b);
writeln(f2,(a+b)/2:4:2);
close(f1);
close(f2);
end.