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.

14 tháng 4 2023

Program HOC24;

var i,n,dem: byte;

d: array[1..20] of integer;

begin

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

for i:=1 to n do 

begin

write('D[',i,']='); readln(d[i]);

end;

dem:=0;

for i:=1 to n do if d[i] mod 2<>0 then dem:=dem+1;

write('Co ',d,' phan tu le trong mang');

readln

end.

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t1,t2,t3;

int main()

{

cin>>n;

t1=0; t2=0; t3=0;

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

{

cin>>x;

t1+=x;

if (x%2==0) t2+=x;

else t3+=x;

}

cout<<t1<<" "<<t2<<" "<<t3;

return 0;

}

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. 

#include <bits/stdc++.h>

using namespace std;

long long b[20],i,n;

int main()

{

cin>>n;

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

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

{

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

}

return 0;

}

5 tháng 3 2022

bạn viết rõ ra giùm mình đc kko 

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

}

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

}

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 x,n,i,t;

int main()

{

cin>>n;

t=0;

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

{

cin>>x;

if (x%2!=0) t+=x;

}

cout<<t;

return 0;

}

24 tháng 2 2022

các bạn ơi chỉ mình với

 

#include <bits/stdc++.h>

using namespace std;

long long n,i,nn,t1,t2,dem1,dem2,a[1000];

int main()

{

cin>>n;

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

nn=a[1];

for (i=1; i<=n; i++) nn=min(nn,a[i]);

cout<<nn<<endl;

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

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

cout<<endl;

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

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

cout<<endl;

t1=0;

t2=0;

dem1=0;

dem2=0;

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

{

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

{

t1+=a[i];

dem1++;

}

else 

{

t2+=a[i];

dem2++;

}

}

cout<<t1<<" "<<dem1<<endl;

cout<<t2<<" "<<dem2;

return 0;

}

20 tháng 2 2022

tham khảo

 

#include <bits/stdc++.h>

using namespace std;

long long n,i,nn,t1,t2,dem1,dem2,a[1000];

int main()

{

cin>>n;

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

nn=a[1];

for (i=1; i<=n; i++) nn=min(nn,a[i]);

cout<<nn<<endl;

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

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

cout<<endl;

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

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

cout<<endl;

t1=0;

t2=0;

dem1=0;

dem2=0;

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

{

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

{

t1+=a[i];

dem1++;

}

else 

{

t2+=a[i];

dem2++;

}

}

cout<<t1<<" "<<dem1<<endl;

cout<<t2<<" "<<dem2;

return 0;

}

uses crt;

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

i,n,min,t1,t2,dem1,dem2:integer;

begin

clrscr;

readln(n);

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

min:=a[1];

for i:=1 to n do if min>a[i] then min:=a[i];

writeln(min);

writeln('Cac so chan la: ');

for i:=1 to n do 

if a[i] mod 2=0 then write(a[i]:4);

writeln;

writeln('Cac so le la: ');

for i:=1 to n do 

  if a[i] mod 2<>0 then write(a[i]:4);

writeln;

t1:=0;

t2:=0;

for i:=1 to n do 

begin

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

else t2:=t2+a[i];

end;

writeln(t1,' ',t2);

dem1:=0;

dem2:=0;

for i:=1 to n do 

  begin

if a[i] mod 2=0 then dem1:=dem1+1

else dem2:=dem2+1;

end;

writeln(dem1,' ',dem2);

readln;

end.