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.
Var f1, f2: text;
Tong, m, n, i: integer;
Begin
assign(f1, ‘DULIEU.TXT’);
reset(f1);
assign(f2, ‘KETQUA’);
rewrite(f2);
Tong;= 0;
read(f1, m, n);
for i:= m to n do
if i mod 2 = 0 then Tong:= Tong+i;
write(f2, Tong);
close(f1);
close(f2);
End.
Var f1, f2: text;
Tong, m, n, i: integer;
Begin
assign(f1, ‘DULIEU.TXT’);
reset(f1);
assign(f2, ‘KETQUA’);
rewrite(f2);
Tong;= 0;
read(f1, m, n);
for i:= m to n do
if i mod 2 = 0 then Tong:= Tong+i;
write(f2, Tong);
close(f1);
close(f2);
End.
const fi='dulieu.txt';
fo='ketqua.txt';
var f1,f2:text;
m,n,i,t:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,m,n);
t:=0;
for i:=m to n do
if i mod 2=0 then t:=t+i;
writeln(f2,t);
close(f1);
close(f2);
end.
Var f1, f2: text;
Tong, m, n, i: integer;
Begin
assign(f1, ‘DULIEU.TXT’);
reset(f1);
assign(f2, ‘KETQUA’);
rewrite(f2);
Tong;= 0;
read(f1, m, n);
for i:= m to n do
if i mod 2 = 0 then Tong:= Tong+i;
write(f2, Tong);
close(f1);
close(f2);
End.
Var f1, f2: text;
Tong, m, n, i: integer;
Begin
assign(f1, ‘DULIEU.TXT’);
reset(f1);
assign(f2, ‘KETQUA’);
rewrite(f2);
Tong;= 0;
read(f1, m, n);
for i:= m to n do
if i mod 2 = 1 then Tong:= Tong+i;
write(f2, Tong);
close(f1);
close(f2);
End.
#include <bits/stdc++.h>
using namespace std;
long long m,n,t,i;
int main()
{
freopen("dulieu.inp","r",stdin);
freopen("ketqua.out","w",stdout);
cin>>m>>n;
t=0;
for (i=m; i<=n; i++)
if (i%2!=0) t+=i;
cout<<t;
return 0;
}
a)
PROGRAM BAI1a;
VAR N, Tle, Tchan: integer;
BEGIN
Write ('Nhap N =');
Readln (N);
If (N mod 2) = 0 Then
Tle := N*((N - 2)/2 + 1)/2;
Tchan := (N + 2)*((N - 2)/2 + 1)/2;
If (N mod 2) = 1 Then
Tle := (N + 1)*((N-1)/2 +1)/2;
Tchan := (N + 1)*((N - 3)/2 + 1)/2;
WRITELN ('Sle =', Sle, 'Schan =', Schan);
READLN;
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.
const fi='dulieu.txt';
fo='ketqua.txt';
var f1,f2:text;
m,n,t,i:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,m,n);
t:=0;
for i:=m to n do
if i mod 3=0 then t:=t+i;
writeln(f2,t);
close(f1);
close(f2);
end.