Những câu hỏi liên quan
Phạm Gia Bình
Xem chi tiết
Minh Lệ
24 tháng 8 2021 lúc 21:12

Program HOC24;

var d,i,n: integer;

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

begin

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

for i:=1 to n do

begin 

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

end;

write('Cac phan tu cua mang vua nhap la: ');

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

writeln;

d:=0;

for i:=1 to n do if 10 mod a[i]=0 then d:=d+1;

writeln('Co ',d,' phan tu co gia tri la uoc cua 10');

write('Cac phan tu o vi tri chan la: ');

for i:=1 to n do if i mod 2=0 then write(a[i],' ');

writeln;

write('Cac phan tu o vi tri le la: ');

for i:=1 to n do if i mod 2=1 then write(a[i],' ');

readln

end.

Bình luận (0)
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)
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)
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)
Tiến Đạt Huỳnh
Xem chi tiết
Thanh Phong (9A5)
27 tháng 4 2023 lúc 10:19

Uses crt;

var i,n: longint;

a: array[1..103] of longint;

begin clrscr;

readln(n);

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

for i:=1 to n do if(a[i] mod 2=0) then write(a[i],'  ');

for i:=1 to n do if(a[i] mod 2<>0) then write(a[i],'  ');

readln;

end.

Bình luận (2)
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)
nguyễn hoàng long
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 1 2022 lúc 22:00

#include <bits/stdc++.h>

using namespace std;

long long a[100],n,i,t,t1,dem,dem1;

//chuongtrinhcon

bool ktnt(long long x)

{

if (x<=1) return(false);

for (int i=2; i*i<=x; i++)

if (x%i==0) return(false);

return true;

}

//chuongtrinhchinh

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++) if (a[i]%2==0) t=t+a[i];

cout<<t<<endl;

dem=0;

for (i=1; i<=n; i++) if (a[i]%3==0) dem++;

cout<<dem<<" ";

t1=0;

dem1=0;

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

if (a[i]%2!=0)

{

t1+=a[i];

dem1++;

}

cout<<fixed<<setprecision(2)<<(t1*1.0)/(dem1*1.0)<<endl;

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

if (ktnt(a[i])==true) cout<<a[i]<<" ";

return 0;

}

Bình luận (0)
Trung Trần Việt
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 3 2022 lúc 19:00

#include <bits/stdc++.h>

using namespace std;

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

int main()

{

n=5;

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<<endl;

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

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

return 0;

}

Bình luận (0)
Cao Thị Thùy Dung
Xem chi tiết
Lee Min Ho
15 tháng 3 2017 lúc 20:15

em không biết

Bình luận (0)