K
Khách

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.

22 tháng 7 2021

Uses crt;
var f1,f2:text;
    i,n,tong,tongchan,dem:integer;
    tb:real;
Begin
 clrscr;
 Assign(f1,'DAYSO.txt');
 Assign(f2,'KETQUA.txt');
 reset(f1);dem:=0;tong:=0;tongchan:=0;
 While Not EOF(f1) do
  Begin
  read(f1,i);
  inc(tong,i);
  If i mod 2 = 0 then
    begin
    inc(dem);
    inc(tongchan,i);
    end;
  End;
 tb:=tongchan/dem;
 close(f1);
 rewrite(f2);
 writeln(f2,tong);
 writeln(f2,tongchan);
 writeln(f2,tb:0:2);
 close(f2);
 write(tong);
 readln;
End.

uses crt;
const fi='dayso.txt';
fa='tong.txt';
fb='kq.txt';
var f1,f2,f3:text;
a:array[1..100]of integer;
n,i,t,kt,j:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fa); rewrite(f2);
assign(f3,fb); rewrite(f3);
n:=0;
while not eof(f1) do
begin
n:=n+1;
readln(f1,a[n]);
end;
{--------------------------cau-a--------------------------}
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(f2,'tong cua day so la: ',t);
{--------------------------cau-b--------------------------}
writeln(f3,'cac so chan trong day la: ');
for i:=1 to n do
if a[i] mod 2=0 then write(f3,a[i]:4);
writeln(f3);
writeln(f3,'cac so le trong day la: ');
for i:=1 to n do
if a[i] mod 2<>0 then write(f3,a[i]:4);
{--------------------------cau-c--------------------------}
writeln('cac so nguyen to trong day la: ');
for i:=1 to n do
if a[i]>1 then
begin
kt:=0;
for j:=2 to a[i]-1 do
if a[i] mod j=0 then kt:=1;
if kt=0 then write(a[i]:4);
end;
close(f1);
close(f2);
close(f3);
readln;
end.

uses crt;

const fi='songuyen.inp';

fo='songuyen2.out';

var a:array[1..100]of integer;

i,n,t1:integer;

f1,f2:text;

begin

clrscr;

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,n);

for i:=1 to n do readln(f1,a[i]);

t1:=0;

for i:=1 to n do if a[i] mod 2<>0 then t1:=t1+a[i];

writeln(t1);

writeln(f2,t1);

for i:=1 to n do 

  if a[i] mod 2<>0 then write(a[i]:4);

close(f1);

close(f2);

readln;

end.

const fi='data1.txt';

fo='data2.txt';

var f1,f2:text;

a,b:real;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,a,b);

writeln(f2,(a+b)/2:4:2);

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;

}

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.

11 tháng 12 2018

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.