Những câu hỏi liên quan
Tống hiền chi
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 4 2022 lúc 22:30

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,dem1,dem2;

int main()

{

cin>>n;

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

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

dem1=0;

dem2=0;

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

{

if (a[i]%2==0) dem1++;

else dem2++;

}

cout<<dem1<<" "<<dem2;

return 0;

}

Bình luận (0)
Hương Lê
Xem chi tiết
Kiều Vũ Linh
10 tháng 5 2023 lúc 17:50

Bài 1

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

i,n:integer;

s:longint;

Begin

Repeat

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

Until (n > 0) and (n < 100);

For i:=1 to n do

Begin

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

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

End;

Write('Cac so vua nhap la: ');

For i:=1 to n do 

Write(a[i]:8);

writeln;

write('Tong cac so chan la ',s);

Readln

End.

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

Bài 2

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

i,n:integer;

s:longint;

Begin

Repeat

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

Until (n > 0) and (n < 100);

For i:=1 to n do

Begin

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

if a[i] mod 2 <> 0 then s:=s+a[i];

End;

Write('Cac so vua nhap la: ');

For i:=1 to n do 

Write(a[i]:8);

writeln;

write('Tong cac so le la ',s);

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)
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)
phạm hải nam
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 3 2022 lúc 9:46

#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];

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

t=0;

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

cout<<t;

return 0;

}

Bình luận (0)
Thảo Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
24 tháng 12 2021 lúc 10:41

#include <bits/stdc++.h>

using namespace std;

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

int main()

{

cin>>n;

t=0;

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

{

cin>>a[i];

t=t+a[i];

}

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

dem=0;

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

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

cout<<dem<<endl;

cout<<t;

return 0;

}

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)
Khang Đinh Hoàng
Xem chi tiết
Luân Đào
21 tháng 5 2021 lúc 15:42

var n,i: integer;

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

begin

write('Nhap so 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 writeln(a[i]);

end.

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

uses crt;

var a:array[1..10]of longint;

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

begin

clrscr;

readln(n);

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

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

writeln;

t:=0;

for i:=1 to n do t:=t+a[i];

writeln(t);

t1:=0;

dem1:=0;

dem2:=0;

for i:=1 to n do 

  begin

if a[i]>0 then dem1:=dem+1;

if a[i] mod 2=0 then 

begin

dem2:=dem2+1;

t1:=t1+a[i];

end;

end;

writeln(dem1);

writeln(t1/dem2:4:2);

readln;

end.

Bình luận (0)
zero
20 tháng 1 2022 lúc 14:08

B

Bình luận (1)
Chanh Xanh
20 tháng 1 2022 lúc 14:08
Bình luận (1)