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.

14 tháng 4 2019

const fi='songuyen.txt';

fo='gtln.txt';

var f, g: text;

max, x: longint;

i, j: byte;

begin

assign(f, fi);

reset(f);

assign(g, fo);

rewrite(g);

max:=minlongint;

for i:=1 to 5 do

for j:=1 to 4 do

begin

read(f, x);

if x>max then max:=x;

if j=4 then readln(f);

end;

write(g, max);

close(f);

close(g);

end.

17 tháng 3 2023

mình cũng cần ạ

17 tháng 3 2023

a)

Input: Số nguyên dương N, dãy số a1,a2,a3,...,an

Output: Tổng các số chẵn nhỏ hơn hoặc bằng N

b)

Program HOC24;

var i,n: integer;

t: longint;

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

f1,f2: text;

const fi='SONGUYEN.TXT';

fo='SOCHAN.TXT';

begin

assign(f1,fi);

assign(f2,fo);

reset(f1);

rewrite(f2);

readln(f1,n);

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

for i:=1 to n do if (a[i] mod 2=0) and (a[i]<=n) then

begin

write(f2,a[i],' ');

t:=t+a[i];

end;

writeln(f2);

write(f2,t);

close(f1); close(f2);

end.

uses crt;

const fi='songuyen.txt';

var f1:text;

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

i,n,t:integer;

begin

clrscr;

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

n:=0;

while not eof(f1) do 

  begin

inc(n);

read(f1,a[n]);

end;

t:=0;

for i:=1 to n do 

  if a[i]>0 then t:=t+a[i];

writeln(t);

close(f1);

readln;

end.

25 tháng 10 2021

Đề thiếu rồi bạn

25 tháng 10 2021

Đề bài yêu cầu gì?

const fi='songuyen.txt';

fo='kluan.txt';

var f1,f2:text;

n:integer;

begin

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

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

readln(f1,n);

if n mod 2=0 then writeln(f2,'La so chan')

else writeln(f2,'La so le');

close(f1);

close(f2);

end.

17 tháng 5 2020

Program HOC24;

const fi='SONGUYEN.TXT';

fo='KETQUA.TXT';

var n,i,d:integer;

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

function nt(x: integer): boolean;

var j: integer;

begin

nt:=true;

if (x=2) or (x=3) then exit;

nt:=false;

if (x=1) or (x mod 2=0) or (x mod 3=0) then exit;

j:=5;

while j<=trunc(sqrt(x)) do

begin

if (x mod j=0) or (x mod (j+2)=0) then exit;

j:=j+6;

end;

nt:=true;

end;

procedure ip;

begin

assign(f,fi);

reset(f);

readln(f,n);

for i:=1 to n do read(f,a[i]);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

d:=0;

for i:=1 to n do

if nt(a[i]) then inc(d);

write(f,d);

close(f);

end;

begin

ip;

out;

end.