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='dulieu.txt';
fo='tong.doc';
var f1,f2:text;
n,i,s:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
s:=0;
for i:=1 to n do
s:=s+i;
writeln(f2,s);
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
freopen("hcn.inp","r",stdin);
freopen("hcn.out","w",stdout);
cin>>a>>b;
cout<<(a+b)*2<<endl;
cout<<a*b;
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.
#include <bits/stdc++.h>
using namespace std;
long long i,a[100],n;
int main()
{
freopen("songuyen.txt","r",stdin);
n=20;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
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.
#include <bits/stdc++.h>
using namespace std;
double a,b,c;
int main()
{
freopen("input.inp","r",stdin);
freopen("output.inp","w",stdout);
cin>>a>>b>>c;
if (a+b>c && a+c>b && b+c>a && a>0 && b>0 && c>0) cout<<"tao thanh tam giac";
else cout<<"khong tao thanh tam giac";
return 0;
}
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.
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.
Program hotrotinhoc_hoc24;
const fi='dulieu.txt';
fo='ketqua.txt';
var f: text;
a,b,c : integer;
procedure ip;
begin
assign(f,fi);
reset(f);
read(f,a,b,c);
close(f);
end;
procedure out;
begin
assign(f,fo);
rewrite(f);
if (a+b>c) and (a+c>b) and (b+c>a) then write(f,a+b+c);
close(f);
end;
begin
ip;
out;
end.
Bài 1:
Program hotrotinhoc_hoc24;
const fi='dulieu.txt';
var a,b: integer;
f: text;
procedure ip;
begin
assign(f,fi);
reset(f);
read(f,a,b);
close(f);
end;
begin
ip;
writeln('Tong la : ',a+b);
write('Hieu la : ',a-b);
readln
end.