Những câu hỏi liên quan
Duy Hùng
Xem chi tiết
Duy Hùng
15 tháng 12 2020 lúc 13:09

Bạn nào giỏi về cái này giúp mình với ạ

 

Bình luận (0)
Nguyễn Lê Phước Thịnh
15 tháng 12 2020 lúc 13:11

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;

writeln('Day A=');

for i:=1 to n do 

  write(a[i]:4);

writeln;

t:=0;

for i:=1 to n do

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

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

readln;

end.

Bình luận (0)
Sarah Lilia
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 2 2021 lúc 20:53

uses crt;

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

i,n,dem,dem1,dem2,t:integer;

s:real;

begin

clrscr;

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

for i:=1 to n do 

begin

repeat

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

until a[i]>0;

end;

for i:=1 to n do 

  write(a[i]:4);

writeln;

dem:=0;

for i:=1 to n do

  if a[i]>10 then inc(dem);

writeln('So phan tu lon hon 10 la: ',dem);

dem1:=0;

dem2:=0;

for i:=1 to n do 

begin

if a[i] mod 2=0 then inc(dem1)

else inc(dem2);

end;

writeln('So luong so chan la: ',dem1);

writeln('So luong so le la: ',dem2);

t:=0;

s:=1;

for i:=1 to n do 

  begin

if (i mod 2=0) and (a[i] mod 2<>1) then t:=t+a[i];

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

end;

writeln('Tong cac so o vi tri chan co gia tri le la: ',t);

writeln('Tich cac so o vi tri le co gia tri chan la: ',s:4:2);

writeln('Cac so le la: ');

for i:=1 to n do 

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

writeln;

writeln('Cac so chan va lon hon 10 la: ');

for i:=1 to n do 

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

readln;

end.

Bình luận (1)
nguyentienlam
Xem chi tiết
nguyentienlam
4 tháng 4 2023 lúc 15:21

cứu m vs

 

Bình luận (0)
Dương
Xem chi tiết
Nguyễn Lê Phước Thịnh
19 tháng 10 2021 lúc 23:30

a: 

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

t=t+x;

}

cout<<t;

return 0;
}

Bình luận (0)
HUỲNH NGỌC BẢO ÂN
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 4 2022 lúc 7:10

#include <bits/stdc++.h>

using namespace std;

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

int main()

{

cin>>n;

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

t=0;

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

if (a[i]%2==0 && i%2==1) t+=a[i];

cout<<t;

return 0;

}

Bình luận (0)
Lam Nguyễn Xuân
Xem chi tiết
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 22:03

uses crt;

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

i,n,k,t:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

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

t:=0;

for i:=1 to n do 

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

writeln(t);

readln;

end.

Bình luận (0)
IVR Gaming
15 tháng 10 2021 lúc 10:16

lớp 11 bth học quy hoạc động ??

 

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)
Văn Công Sỹ
Xem chi tiết
Văn Công Sỹ
25 tháng 4 2021 lúc 10:28

Làm giúp bài này nhé

 

Bình luận (0)
Bùi Anh Tuấn
25 tháng 4 2021 lúc 19:41

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

uses crt;

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

i,n,min,tam,j: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('Gia tri nho nhat la: ',min);

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;

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

readln;

end.

Bình luận (0)
Nguyễn Thái Phương Thảo
Xem chi tiết