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.

uses crt;

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

i,n,max:integer;

begin

clrscr;

repeat

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

until (1<n) and (n<=255);

for i:=1 to n do 

  begin

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

end;

writeln('Day so vua nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

max:=a[1];

for i:=1 to n do 

 if max<a[i] then max:=a[i];

writeln('Gia tri lon nhat la: ',max);

readln;

end.

uses crt;

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

i,n,vt:integer;

begin

clrscr;

repeat

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

until (1<n) and (n<=255);

for i:=1 to n do 

  begin

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

end;

writeln('Day so vua nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

vt:=n;

for i:=n downto 1 do 

  if a[i]>0 then 

begin

if vt>i then vt:=i;

end;

if (vt=n) and (a[n]<=0) then writeln('Trong day khong co so duong')

else writeln('Chi so so hang duong dau tien trong day la: ',vt);

readln;

end.

Bài 1: 

uses crt;

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

i,n,min:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

min:=a[1];

for i:=1 to n do 

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

writeln(min);

readln;

end.

Bài 2: 

uses crt;

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

i,n,max:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

max:=a[1];

for i:=1 to n do 

 if max<a[i] then max:=a[i];

writeln(max);

readln;

end.

uses crt;

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

i,n,t:integer;

begin

clrscr;

readln(n);

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

t:=0;

for i:=1 to n do 

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

writeln(t);

readln;

end.

a) 

uses crt;

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

i,n,max:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

max:=a[1];

for i:=1 to n do 

 if max<a[i] then max:=a[i];

writeln(max);

readln;

end.

b) 

uses crt;

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

i,n,min:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

min:=a[1];

for i:=1 to n do 

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

writeln(min);

readln;

end.

uses crt;

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

i,n:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

for i:=1 to n do 

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

readln;

end.

7 tháng 6 2021

uses crt;
var a:array[1..1000000] of longint;
      n,i:longint;
begin
      clrscr;
      write('Nhap so luong phan tu: '); readln(n);
      for i:=1 to n do 
            begin
                  write('Nhap phan tu thu ',i,': '); readln(a[i]);
            end;
      write('Cac so chan: ');
      for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
      readln;
end.

30 tháng 4 2021

Program HOC24;

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

i,max,,n: integer;

begin

write('Nhap so phan tu N: '); readln(N);

for i:=1 to n do

begin

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

end;

max:=a[1];

for i:=1 to n do

if a[i]<max then max:=a[i];

write('So lon nhat la: ',max);

readln

end.

7 tháng 6 2021

uses crt;
var a:array[1..1000000] of longint;
      n,i,max:longint;
begin
      clrscr;
      write('Nhap so luong phan tu: '); readln(n);
      max:=a[1];
      for i:=1 to n do 
            begin
                  write('Nhap phan tu thu ',i,': '); readln(a[i]);
                  if a[i]>max then max:=a[i];
            end;
      writeln('GTLN: ',max);
      readln;
end.

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

5 tháng 5 2022

Program bai_tap;

Uses crt;

Var i, n, S: Integer;

begin

clrscr;

Write('Nhap n='); read(n);

For i:=1 to n do S=s+i;

Write('tong la',',);

End.

23 tháng 5 2022

program trungbinh;

uses crt;

var n,i: integer;

      s:real;

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

begin

clrscr;

write('Nhap do dai day: '); readln(n);

writeln('Nhap gia tri cua day: ');

S:=0;

for i:=1 to n do

begin

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

readln(A[i]);

S:=S+A[i];

end;

S:=S/n;

write('Trung binh cua cac so cua day do la: ',S);

readln;

end.