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.

Câu 1: 

uses crt;

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

i,n:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

for i:=1 to n do 

  write(a[i]:4);

readln;

end.

Câu 2: 

uses crt;

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

i,n:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

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;

writeln('Cac so chia het cho 3 la: ');

for i:=1 to n do 

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

readln;

end.

Câu 3: 

uses crt;

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

i,n:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

writeln('Cac so o vi tri chan la: ');

for i:=1 to n do 

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

writeln;

writeln('Cac so o vi tri le la: ');

for i:=1 to n do 

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

readln;

end.

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;

writeln('Mang nguoc la: ');

for i:=n downto 1 do 

  write(a[i]:4);

writeln;

t:=0;

for i:=1 to n do 

  if (a[i] mod 2=0) and (i mod 2=1) then t:=t+a[i];

writeln('Tong cac so chan co chi so le la: ',t);

writeln('Cac so chia het cho 2 va 5 la: ');

for i:=1 to n do 

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

readln;

end.

#include <bits/stdc++.h>

using namespace std;

long long a[10000],i,n;

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+=a[i];

cout<<"Tong cac so chan la: "<<t<<endl;

sort(a+1,a+n+1);

cout<<"Day so giam dan la: ";

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

return 0;

}

25 tháng 2 2022

Nhưng mà cái này dùng theo pascal và theo kiểu mảng ạ

#include <bits/stdc++.h>

using namespace std;

long long a[1000],i,n;

int main()

{

cin>>n;

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

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

cout<<endl;

cout<<"Cac so duong la: ";

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

cout<<endl;

for (i=1; i<=n; i++) if (a[i]%2==0) cout<<a[i]<<" ";

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

return 0;

}

15 tháng 3 2023

uses crt;

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

n,i:integer;

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

writeln('Cac phan tu chan la: ');

for i:=1 to n do

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

readln;

end.

15 tháng 3 2023

mn giúp em với ạ uhuhu

 

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

}

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;

}

10 tháng 3 2021

17 tháng 12 2021

#include <bits/stdc++.h>

using namespace std;

long long n,i,x,dem;

int main()

{

cin>>n;

dem=0;

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

{

cin>>x;

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

}

cout<<dem;

return 0;

}

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.

21 tháng 5 2022

chạy rồi thì nhập gì để cho ra kết quả như bên phải ạ ?undefined