Những câu hỏi liên quan
Phạm Gia Bình
Xem chi tiết
Anh Phạm
17 tháng 8 2021 lúc 9:54

uses crt;

var n,i,chan,tonchan:integer;

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

begin

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

for i:=1 to n do

begin

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

end;

writeln("in cac phan tu trong mang");

for i:=1 to n do

begin

writeln(a[i]);

end;

writeln("in cac phan tu chan");

chan:=0;

for i:=1 to n do

if n mod 2=0 then begin writeln(a[i]); chan:=chan+1; end;

write('tong cac phan tu chan ',chan);

readln;

end.

 

Bình luận (3)
ngomanhcuong
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 3 2022 lúc 20:25

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t,dem;

int main()

{

cin>>n;

dem=0;

t=0;

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

{

cin>>x;

if (x%2==0 && x>10) t+=x;

if (x%2!=0 || x<100) dem++;

}

cout<<t<<" "<<dem;

return 0;

}

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)
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)
Thu Hiền
Xem chi tiết
Bao112233
17 tháng 12 2022 lúc 21:34

var n,i,dem,t:integer;
a:array[1..50] of integer;
begin
    dem:=0;
    t:=0;
    read(n);
    for i:=1 to n do 
    read(a[i]);
    for i:=n downto 1 do
    write(a[i]);
    writeln;
    for i:=1 to n do 
    if (a[i] mod 2 = 0) then dem:=dem+1;
    if a[i]<a[i-1] then t:=t+1;
    writeln(dem);
    if t=0 then write('Co lap thanh cap so +')
    else write('Ko the lap thanh cap so +');
    readln;
end.

Bình luận (0)
Võ Thu Hằng
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2021 lúc 13:51

uses crt;

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

i,n,dem,t:integer;

begin

clrscr;

repeat

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

until (0<n) and (n<=1000);

for i:=1 to n do 

begin

repeat

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

until abs(a[i])<=1000;

end;

for i:=1 to n do 

  write(a[i]:4);

writeln;

dem:=0;

for i:=1 to n do 

  if a[i]=0 then inc(dem);

writeln('So phan tu bang 0 la: ',dem);

t:=0;

for i:=1 to n do 

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

writeln('Tong cac phan tu chan la: ',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)
Ngọc Hân Lương Thị
Xem chi tiết
Kiều Vũ Linh
29 tháng 4 2023 lúc 11:11

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

i,n,d:integer;

Begin

For i:=1 to 20 do

Begin

Write('Nhap phan tu thu ',i);readln(a[i]);

if a[i] = 3 then d:=d+1;

End;

Write('Co ',d,' chu so 3');

Readln

End.

Bình luận (0)
taf.amp
Xem chi tiết
Kiều Vũ Linh
2 tháng 5 2022 lúc 7:52

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

i,n,d,max:integer;

Begin

Write('Nhap so luong phan tu cua mang ');readln(n);

For i:=1 to n do

Begin

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

End;

max:=a[1];

For i:=2 to n do

Begin

If a[i] > max then

Begin

max:=a[i];

d:=i;

End;

End;

Write('Phan tu lon nhat la ',max,' o vi tri ',d);

Readln;

End.

Bình luận (0)