Những câu hỏi liên quan
Võ Trần Nguyên
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 4 2021 lúc 20:44

uses crt;

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

i,n,t,dem:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

t:=0;

dem:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then

begin

t:=t+a[i];

inc(dem);

end;

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

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

readln;

end.

Bình luận (0)
Vochehoang
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 4 2021 lúc 20:04

Câu 1: 

uses crt;

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

i,n:integer;

t:real;

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:4:2);

readln;

end.

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

Câu 2: 

uses crt;

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

i,n:integer;

t:real;

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:4:2);

readln;

end.

Bình luận (0)
Nguyễn Quang Hà
Xem chi tiết
Nguyễn Lê Phước Thịnh
24 tháng 2 2022 lúc 13:39

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t1,t2,t3;

int main()

{

cin>>n;

t1=0; t2=0; t3=0;

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

{

cin>>x;

t1+=x;

if (x%2==0) t2+=x;

else t3+=x;

}

cout<<t1<<" "<<t2<<" "<<t3;

return 0;

}

Bình luận (0)
Thị Na Trần
Xem chi tiết
Minh Lệ
30 tháng 4 2023 lúc 13:24

Program HOC24;

var i,n: byte;

t: longint:

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

begin

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

for i:=1 to n do begin write('A[',i,']='); readln(a[i]); end;

t:=0;

write('Cac phan tu chan co trong mang la: ');

for i:=1 to n do

if a[i] mod 2=0 then

begin

write(a[i],' ');

t:=t+a[i];

end;

writeln;

write('Tong cac phan tu chan do la: ',t);

readln

end.

Bình luận (1)
Thành Tân B1-
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 12 2021 lúc 8:42

Bài 2: 

uses crt;

var x,i,n,dem:integer;

begin

clrscr;

readln(n);

dem:=0;

for i:=1 to n do 

begin

readln(x);

if x mod 2=0 then inc(dem);

end;

writeln(dem);

readln;

end.

Bình luận (1)
Phan Hùng Anh
Xem chi tiết
Minh Lệ
2 tháng 5 2023 lúc 20:48

Program HOC24;

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

i,n: byte;

t: longint;

begin

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

for i:=1 to n do

begin

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

end;

write('Cac phan tu chan trong mang la: ');

for i:=1 to n do

if a[i] mod 2=0 then

begin

write(a[i],' ');

t:=t+a[i];

end;

writeln;

write('Tong cac phan tu chan trong day la: ',t);

readln

end.

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)
my trần
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 8 2021 lúc 19:15

uses crt;

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

i,n,dem,max,t,min,dem1:integer;

begin

clrscr;

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

for i:=1 to n do 

 begin

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

end;

dem:=0;

max:=-32000;

for i:=1 to n do 

  begin

if a[i] mod 2=0 then 

begin

dem:=dem+1;

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

end;

if dem=0 then writeln('Trong day khong co so chan')

else begin

writeln('So so chan la: ',dem);

writeln('So chan lon nhat la: ',max);

end;

t:=0;

for i:=1 to n do 

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

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

min:=maxint;

dem1:=0;

for i:=1 to n do 

  if a[i] mod 2<>0 then

begin  

inc(dem1);

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

end;

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

else writeln('So le nho nhat la: ',min);

readln;

end. 

Bình luận (0)
Benny
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 3 2023 lúc 14:55

6:

#include <bits/stdc++.h>

using namespace std;

int main()

{

int n,A[100],i,dem=0;

cin>>n;

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

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

if (A[i]%2!=0) dem++;

cout<<dem;

return 0;

}

5:

#include <bits/stdc++.h>

using namespace std;

int main()

{

long long n,nn=1e6,A[1000];

cin>>n;

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

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

nn=min(nn,A[i]);

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

if (nn==A[i]) cout<<i<<" ";

return 0;

}

Bình luận (0)