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.

const fi='dulieu.inp';

fo='dulieu.out';

var f1,f2:text;

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

n,i,dem:integer;

begin

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

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

n:=0;

while not eof(f1) do 

 begin

n:=n+1;

readln(f1,a[n]);

end;

dem:=0;

for i:=1 to n do

if a[i] mod 2=0 then inc(dem);

writeln(f2,dem);

close(f1);

close(f2);

end.

const fi='bai1.inp';

fo='bai1.out';

var f1,f2:text;

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

n,i,t,dem: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]);

t:=0;

dem:=0;

for i:=1 to n do 

  begin

if a[i] mod 2<>0 then t:=t+a[i]

else inc(dem);

end;

writeln(f2,'Tong cac so le la: ',t);

writeln(f2,'So so chan la: ',dem);

close(f1);

close(f2);

end.

#include <bits/stdc++.h>

using namespace std;

string st;

int d,i,dem;

int main()

{

freopen("xau.inp","r",stdin);

freopen("xau.out","w",stdout);

cin>>st;

d=st.length();

dem=0;

for (i=0; i<=d-1; i++)

if (st[i]=='a') dem++;

cout<<dem;

return 0;

}

const fi='input.txt';

fo='soan.txt';

var f1,f2:text;

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

i,n:integer;

begin

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

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

n:=0;

while not eof(f1) do 

  begin

n:=n+1;

readln(f1,a[n]);

end;

for i:=1 to n do 

  if a[i]<0 then writeln(f2,a[i]:4);

close(f1);

close(f2);

end.

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.

const fi='songuyen.inp';

fo='tong.out';

var f1,f2:text;

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

n,i,dem:integer;

begin

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

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

n:=0;

while not eof(f1) do 

  begin

n:=n+1;

read(f1,a[n]);

end;

dem:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then inc(dem);

writeln(f2,dem);

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;

}