Những câu hỏi liên quan
Shirley Hanamura
Xem chi tiết
Shirley Hanamura
Xem chi tiết
bui pham phuong Uyen
Xem chi tiết
Nguyễn Lê Phước Thịnh
27 tháng 1 2021 lúc 13:15

Bài 1: 

uses crt;

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

i,n,kt,max,x,j,tam:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

writeln('Mang ban vua nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

for i:=1 to n-1 do 

  for j:=i+1 to n do 

if a[i]>a[j] then 

begin

tam:=a[i];

a[i]:=a[j];

a[j]:=tam;

end;

writeln('Day tang dan la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

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

max:=0;

kt:=0;

for i:=1 to n do 

  if (a[i] mod 2=0) and (a[i]<=x) then 

   begin

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

kt:=1;

end;

if kt=0 then writeln('Trong day khong co so le')

else writeln('So chan lon nhat khong vuot qua ',x,' la: ',max);

readln;

end.

Bình luận (0)
Danh Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 7:23

Bài 1:

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t;

int main()

{

cin>>n;

t=0;

for (i=1; i<=n; i++)

{

cin>>x;

if ((x<0) and (x%2!=0)) t=t+x;

}

cout<<t;

return 0;

}

Bình luận (0)
Minh Duy
Xem chi tiết
Bùi Anh Tuấn
27 tháng 4 2021 lúc 19:53

 tách ra từng câu hỏi đi bro

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

Câu 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 2=0 then t:=t+a[i];

writeln(t);

readln;

end.

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

2:

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:=1;

for i:=1 to n do 

  t:=t*a[i];

writeln(t);

readln;

end.

Bình luận (0)
Tran Trang
Xem chi tiết
HT.Phong (9A5)
20 tháng 4 2023 lúc 12:25

Uses crt;

var n,i,max,min: integer;

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

begin clrscr;

readln(n);

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

max:=a[1];

for i:=1 to n do if(max<a[i]) then max:=a[i];

writeln(max);

min:=a[1];

for i:=1 to n do if(min>a[i]) then min:=a[i];

writeln(min);

readln;

end.

Bình luận (0)
Thwn Dayy
Xem chi tiết
Kiều Vũ Linh
5 tháng 5 2023 lúc 9:27

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

i,n,min:integer;

begin

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

for i:=1 to n do

begin

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

end;

min:=a[1];

for i:=2 to n do

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

write('So nho nhat la ',min);

readln

end.

Bình luận (2)
Thảo Nguyên 36-88
Xem chi tiết
JamesDang
26 tháng 3 2022 lúc 20:01

uses crt;
var a: array[1..100] of longint;
    i,n,max,min: longint;

begin
    clrscr;
    readln(n);
    for i:=1 to n do
    begin
        write('Nhap so thu ',i,': '); 
        readln(a[i]);
    end;
    max:=a[1]; min:=a[1];
    for i:=1 to n do
    begin
        if max<a[i] then max:=a[i];
        if min>a[i] then min:=a[i];
    end;
    writeln('So lon nhat trong mang la: ',max);
    write('So nho nhat trong mang la: ',min);
    readln
end.

Bình luận (0)
My Nguyen
Xem chi tiết
Huỳnh Trúc Ly
Xem chi tiết
Phía sau một cô gái
5 tháng 5 2023 lúc 20:26

program Nhapmang;

const MAX_N = 100;

var A: array[1..MAX_N] of integer;

      N, i:integer;

begin

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

      for i:= 1 to N do begin

            write('Nhap phan tu ', i, ': ');

            readln(A[i]);

      end;

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

      for i:= 1 to N do

            write(A[i], ' ');

end.

Bình luận (0)