Những câu hỏi liên quan
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)
ttrr
Xem chi tiết
Minh Lệ
12 tháng 4 2022 lúc 19:27

Program HOC24;

var i,d,n,x: integer;

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

begin

write('Nhap so phan tu: '); readln(n);

for i:=1 to n do 

begin

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

end;

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

d:=0;

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

write(d);

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)
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)
feng
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 5 2022 lúc 10:07

uses crt;

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

n,i,t,nn,kt:integer;

begin

clrscr;

readln(n);

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

t:=1;

for i:=1 to n do 

  if a[i] mod 3=0 then t:=t*a[i];

writeln(t);

kt:=0;

nn:=32567;

for i:=1 to n do 

  if a[i] mod 3=0 then 

begin

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

kt:=1;

end;

if kt=0 then writeln('Khong co so chia het cho 3')

else writeln('So nho nhat chia het cho 3 la: ',nn);

for i:=1 to n do 

  if nn=a[i] then write(i:4);

writeln;

for i:=n downto 1 do 

  write(a[i]:4);

readln;

end.

Bình luận (1)
Thảo Nguyễn
Xem chi tiết
Thảo Nguyễn
22 tháng 12 2021 lúc 8:36

giúp em với ạ em cần gấp :(

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

#include <bits/stdc++.h>

using namespace std;

long long a[10],i,dem;

int main()

{

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

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

cout<<endl;

dem=0;

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

cout<<dem;

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)
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)
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)