Những câu hỏi liên quan
Bé Kunz
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 22:24

Bài 1: 

uses crt;

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

i,n,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

begin

write('A[',i,']='); readln(a[i]);

end;

t:=0;

for i:=1 to n do 

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

writeln('Tong cac so chia het cho 5 la: ',t);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 22:25

Bài 2: 

uses crt;

var st:string;

d,i:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

for i:=1 to d do 

  if st[i]=#32 then delete(st,i,1);

writeln(st);

readln;

end.

Bình luận (0)
scar titan
28 tháng 7 2021 lúc 10:11

python có ko bạn

 

Bình luận (0)
NguyenThiChongDinh
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 4 2022 lúc 22:10

Bài 3: 

uses crt;

const fi='teptong.txt'

var a,b:integer;

f1:text;

begin

clrscr;

assign(f1,fi); rewrite(f1);

readln(a,b);

writeln(a+b);

writeln(f1,a+b);

close(f1);

readln;

end.

Bình luận (0)
Mĩ Lâm
Xem chi tiết
Nguyên Hưng Trần
22 tháng 7 2021 lúc 21:25

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.

Bình luận (0)
lamgi hoi
Xem chi tiết
Anh Phạm
25 tháng 7 2021 lúc 14:23

cau 1:

uses crt;

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

n,i,min: integer;

begin

readln(n);

for i:=1 to n do

readln(a[i]);

min:=a[1];

for i:=2 to n do

if min>a[i] then min=a[i];

writeln(a[i]);

readln;

end.

cau 2:

uses crt;

g:text;

s:string;

const fo='CHUSO.TXT'

begin

assign(g,fo);

rewrite(g);

readln(s);

for i:=1 to length(s) do

if not((s[i] in ['a'..'z'])and(s[i] in ['A'..'Z])) then delete(s,i,1);

writeln(g,s);

end.

Bình luận (0)
misha
Xem chi tiết
Nguyễn Cảnh Hùng
Xem chi tiết
Đỗ Ngọc Trinh
31 tháng 8 2018 lúc 16:53

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.

Bình luận (0)
Nguyễn Cảnh Hùng
Xem chi tiết
Đỗ Ngọc Trinh
7 tháng 4 2019 lúc 15:31

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.

Bình luận (0)
Phan Thị Thùy Ngân
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 5 2021 lúc 22:29

Câu 2: 

uses crt;

var a,b:integer;

{-----------------chuong-trinh-con-------------------}

function ucln(x,y:integer):integer;

var i,uc:integer;

begin

if x<y then 

begin

uc:=1;

for i:=1 to x do 

  if (x mod i=0) and (y mod i=0) then  

begin

if uc<i then uc:=i;

end;

end

else begin

uc:=1;

for i:=1 to y do 

  if (x mod i=0) and (y mod i=0) then  

begin

if uc<i then uc:=i;

end;

end;

ucln:=uc;

end;

{--------------------------chuong-trinh-chinh------------------------}

begin

clrscr;

write('Nhap a='); readln(a);

write('Nhap b='); readln(b);

writeln(a,'/',b,'=',a div ucln(a,b),'/',b div ucln(a,b));

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
2 tháng 5 2021 lúc 22:30

Câu 1: 

const fi='songuyen.inp'

fo='tong.out'

var f1,f2:text;

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

i,n,t:integer;

begin

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

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

n:=0;

while not eoln(f1) do 

  begin

n:=n+1;

read(f1,a[n]);

end;

t:=0;

for i:=1 to n do 

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

writeln(f2,t);

close(f1);

close(f2);

end.

Bình luận (0)
Nguyễn Bảo Việt
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 10 2021 lúc 0:18

Bài 2: 

#include <bits/stdc++.h>;

using namespace std;

int main();

{

long m,n;

cout<<"Nhap m="; cin>>m;

cout<<"Nhap n="; cin>>n;

cout<<m*n-2;

return 0;

}

Bình luận (0)