Những câu hỏi liên quan
8/1 Ngọc Hân
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 4 2022 lúc 22:26

c: 

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

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

if (a[i]%2==0) cout<<a[i]<<" ";

return 0;

}

d: 

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,nn;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

nn=a[1];

for (i=1; i<=n; i++) nn=min(nn,a[i]);

cout<<nn;

return 0;

}

Bình luận (0)
Ngáo Ngơ Alice
Xem chi tiết
nguyễn an phát
11 tháng 4 2021 lúc 12:02

program timtich;

uses  crt;

var i,n:integer;

tich:longint;

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

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do

begin

write('nhap phan tu a[',i,']:');readln(a[i]);

end;

for i:=1 to n do

write(a[i]:4);

tich:=1;

writeln;

for i:=1 to n do

if a[i] mod 2=0 then tich:=tich*a[i];

writeln('tich ca phan tu chan cua mang la:',tich);

readln;

end.

program timtong;

uses  crt;

var i,n:integer;

tong:longint;

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

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do

begin

write('nhap phan tu a[',i,']:');readln(a[i]);

end;

for i:=1 to n do

write(a[i]:4);

tong:=0;

writeln;

for i:=1 to n do

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

writeln('tong cac phan tu chan cua mang la:',tong);

tong:=0;

writeln;

for i:=1 to n do

if a[i] mod 2=1 then tong:=tong+a[i];

writeln('tong cac phan tu le cua mang la:',tong);

readln;

end.

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

Bài 1: 

uses crt;

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

i,n,s:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

s:=1;

for i:=1 to n do 

  if a[i] mod 2=0 then s:=s*a[i];

writeln(s);

readln;

end.

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

uses crt;

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

i,n,t1,t2:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

t1:=0;

t2:=0;

for i:=1 to n do

begin

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

else t2:=t2+a[i];

end;

writeln('Tong cac so chan la: ',t1);

writeln('Tong cac so le la: ',t2);

readln;

end.

Bình luận (0)
Hoàng Trần Thanh Hà _THP...
Xem chi tiết
gấu béo
26 tháng 3 2023 lúc 22:37

n = int(input("Nhập n: "))

a = [ ]

for i in range(n):

     a.append(int(input(f"Nhập phần tử a[{i}]: ")))

print("Dãy số vừa nhập:")

# In dãy số theo thứ tự ngược lại

print(a[::-1]) 

if a == a[::-1]:

     print("Dãy số là dãy đối xứng")

else:

     print("Dãy số không phải là dãy đối xứng")

Bình luận (0)
Đặng Đức Nam
Xem chi tiết
Kiều Vũ Linh
20 tháng 4 2023 lúc 8:56

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

i,n:integer;

sc,sl:longint;

Begin

Write('Nhap so luong so cua day ');readln(n);

For i:=1 to n do

Begin

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

End;

Write('Tong cac so chan la ');

For i:=1 to n do

If a[i] mod 2 = 0 then sc:=sc+a[i];

Writeln(sc);

Write('Tong cac so le la ');

For i:=1 to n do

If a[i] mod 2 <> 0 then sl:=sl+a[i];

Write(sl);

Readln

End.

Bình luận (0)
tiến bộc phấ
Xem chi tiết
Huy Phạm
Xem chi tiết
Kiều Vũ Linh
3 tháng 5 2023 lúc 6:12

1)

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

i,n,t:integer;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

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

End;

For i:=1 to n do

If a[i] > a[i+1] then

Begin

t:=a[i];

a[i]:=a[i+1];

a[i+1]:=t;

End;

Write('Sap xep tang dan ');

For i:=1 to n do write(a[i]:8);

Readln

End.

Bình luận (0)
Kiều Vũ Linh
3 tháng 5 2023 lúc 6:13

2)

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

i,n,t:integer;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

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

End;

For i:=1 to n do

If a[i] < a[i+1] then

Begin

t:=a[i];

a[i]:=a[i+1];

a[i+1]:=t;

End;

Write('Sap xep giam dan ');

For i:=1 to n do write(a[i]:8);

Readln

End.

Bình luận (0)
Hiền Nguyễn
Xem chi tiết
Hiền Nguyễn
24 tháng 3 2021 lúc 9:08

Bạn ơi giúp mình với chiều nay mình thi rồi

 

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

Câu 2: 

uses crt;

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

i,n,tb:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

tb:=0;

for i:=1 to n do 

  tb:=tb+a[i];

writeln(tb/n:4:2);

readln;

end.

Bình luận (0)
Phạm Vy
Xem chi tiết
Nguyễn Lê Phước Thịnh
12 tháng 2 2022 lúc 10:02

#include <bits/stdc++.h>

using namespace std;

long long n,a[1000],m,i;

bool kt;

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

cin>>m;

kt=false;

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

if (a[i]==m) kt=true;

if (kt==true) cout<<"Co";

else cout<<"Khong";

return 0;

}

Bình luận (2)
Minh Lệ
13 tháng 2 2022 lúc 23:52

Program HOC24;

var m,i,n,d: integer;

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

begin

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

for i:=1 to n do

begin

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

end;

write('Nhap M: '); readln(m);

d:=0;

for i:=1 to N do if a[i]=m then d:=d+1;

if d<>0 then (m,' thuoc day vua nhap');

readln

end.

Bình luận (0)
Trần Hà Thư
Xem chi tiết
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 22:07

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.

Bình luận (0)
Lê Thị Thu Phương
7 tháng 6 2021 lúc 21:02

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.

Bình luận (0)