K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

13 tháng 3 2021

Program HOC24;

var i,n: integer;

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

d: integer;

begin

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

d:=0;

for i:=1 to n do

begin

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

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

end;

write('Co ',d,' phan tu la boi cua 3');

readln

end.

uses crt;

var i,n,dem:integer;

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

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

dem:=0;

for i:=1 to n do

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

writeln(dem);

readln;

end.

uses crt;

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

n,i,k,dem,dem1:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

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

dem:=0;

dem1:=0;

for i:=1 to n do 

  begin

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

if a[i] mod k=0 then inc(dem1);

end;

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

writeln('So phan tu chia het cho ',k,' la: ',dem1);

readln;

end.

uses crt;

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

i,dem,t:integer;

begin

clrscr;

for i:=1 to 6 do 

  begin

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

end;

dem:=0;

t:=0;

for i:=1 to 6 do 

if a[i]>0 then 

begin

inc(dem);

t:=t+a[i];

end;

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

writeln('Tong cac phan tu duong la: ',t);

readln;

end.

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,dem,t,j,t1;

int main()

{

cin>>n;

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

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

cout<<endl;

dem=0;

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

{

t=0;

for (j=1; j<=a[i]-1; j++)

if (a[i]%j==0) t+=j;

if (t==a[i]) dem++;

}

cout<<dem<<endl;

t1=0;

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

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

cout<<t1;

return 0;

}

25 tháng 5 2022

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,dem,t,j,t1;

int main()

{

cin>>n;

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

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

cout<<endl;

dem=0;

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

{

t=0;

for (j=1; j<=a[i]-1; j++)

if (a[i]%j==0) t+=j;

if (t==a[i]) dem++;

}

cout<<dem<<endl;

t1=0;

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

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

cout<<t1;

return 0;

}

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,dem,t,j,t1;

int main()

{

cin>>n;

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

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

cout<<endl;

dem=0;

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

{

t=0;

for (j=1; j<=a[i]-1; j++)

if (a[i]%j==0) t+=j;

if (t==a[i]) dem++;

}

cout<<dem<<endl;

t1=0;

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

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

cout<<t1;

return 0;

}

20 tháng 12 2021

#include <bits/stdc++.h>

using namespace std;

long long n,i,a[10000];

int main()

{

cin>>n;

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

cin>>a[i];

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

return 0;

}

16 tháng 12 2022

#include <bits/stdc++.h>

using namespace std;

int A[500],n,i,dem,dem1;

int main()

{

cin>>n;

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

for (int i=n; i>=1; i--) cout<<A[i]<<" ";

cout<<endl;

dem=0;

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

if (A[i]<10) dem++;

cout<<dem<<endl;

dem1=0;

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

if (A[i]>1)

{

bool kt=true;

for (int j=2; j*j<=A[i]; j++)

if (A[i]%j==0) kt=false;

if (kt==true) dem1++;

}

cout<<dem1;

return 0;

}

17 tháng 12 2022

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.