...">
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.

7 tháng 6 2020

Câu 2:

Program HOC24;

var i,n,m: integer;

tb,tb1: longint;

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

begin

write('Nhap so N : '); readln(n);

tb:=0;

for i:=1 to n do

begin

write('Nhap so thu ',i,' : '); readln(a[i]);

tb:=tb+a[i];

end;

write('Nhap so M : '); readln(n);

tb1:=0;

for i:=1 to m do

begin

write('Nhap so thu ',i,' : '); readln(b[i]);

tb1:=tb1+b[i];

end;

if (tb/n)>(tb1/m) then write('Trung binh cong cua N so lon hon M so')

else write('Trung binh cong cua M so lon hon N so')

else (tb/n)=(tb1/m) then write('Trung binh cong cua M so bang hon N so');

readln

end.

7 tháng 6 2020

Câu 1:

Program HOC24;

var s,st: string;

n,i,j: integer;

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

function chuyen(x: string): string;

begin

x[1]:=upcase(x[1]);

chuyen:=x;

end;

begin

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

while s[1]=#32 do delete(s,1,1);

while s[length(s)]=#32 do delete(s,length(s),1);

while pos(#32#32,s)<>0 do delete(s,pos(#32#32,s),1);

writeln('Xau sau khi xoa dau cach : ',s);

st:=s;

s:=s+' ';

while length(s)<>0 do

begin

st:=copy(s,1,pos(' ',s)-1);

n:=n+1;

a[n]:=st;

delete(s,1,pos(' ',s));

end;

write('Cac ki tu in hoa dau tien cua moi tu : ');

for i:=1 to n do write(chuyen(a[i]),' ');

writeln;

writeln('Vi tri cuoi cung cua ki tu cuoi cung so : ',length(st));

write('Sau khi xoa tu cuoi cung : ');

for i:=1 to n-1 do write(chuyen(a[i]),' ');

readln

end.

25 tháng 7 2021

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.

1:

uses crt;

var a:array[1..100]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 2<>0 then t:=t+a[i];

writeln(t);

readln;

end.

3:

const fi='dl.txt';

fo='kq.txt';

var f1,f2:text;

a:integer;

begin

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

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

readln(f1,a);

writeln(f2,a);

close(f1);

close(f2);

end.

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.

Câu 1:

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

Câu 2: 

uses crt;

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

i:integer;

begin

clrscr;

for i:=1 to 10 do 

  begin

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

end;

for i:=1 to 10 do 

 write(a[i]:4);

readln;

end.

Câu 3: 

uses crt;

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

i,n,t:integer;

begin

clrscr;

repeat

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

until (0<n) and (n<=15);

for i:=1 to n do 

begin

repeat

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

until a[i]<=100;

end;

writeln('Mang da nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

t:=0;

for i:=1 to n do

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

writeln('Tong cac phan tu chia het cho 3 la: ',t);

writeln('Cac so chan o vi tri le trong day la: ');

for i:=1 to n do 

  if (a[i] mod 2=0) and (i mod 2=1) then write(a[i]:4);

readln;

end.

1:

uses crt;

const fi='ketqua.txt';

var f1:text;

st:string;

i,d:integer;

begin

clrscr;

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

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

d:=length(st);

for i:=1 to d do 

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

writeln(f1,st);

close(f1);

end.

2:

uses crt;

var a,b,c,d:integer;

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

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

begin

if x<y then min:=x

else min:=y;

end;

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

begin

clrscr;

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

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

write('c='); readln(c);

write('d='); readln(d);

writeln(min(a,min(b,min(c,d))));

readln;

end.