Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
Sarah Lilia
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 2 2021 lúc 20:53

uses crt;

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

i,n,dem,dem1,dem2,t:integer;

s:real;

begin

clrscr;

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

for i:=1 to n do 

begin

repeat

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

until a[i]>0;

end;

for i:=1 to n do 

  write(a[i]:4);

writeln;

dem:=0;

for i:=1 to n do

  if a[i]>10 then inc(dem);

writeln('So phan tu lon hon 10 la: ',dem);

dem1:=0;

dem2:=0;

for i:=1 to n do 

begin

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

else inc(dem2);

end;

writeln('So luong so chan la: ',dem1);

writeln('So luong so le la: ',dem2);

t:=0;

s:=1;

for i:=1 to n do 

  begin

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

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

end;

writeln('Tong cac so o vi tri chan co gia tri le la: ',t);

writeln('Tich cac so o vi tri le co gia tri chan la: ',s:4:2);

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 chan va lon hon 10 la: ');

for i:=1 to n do 

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

readln;

end.

Ly Khánh
Xem chi tiết
Hải Hà
Xem chi tiết
Võ Ngọc Huy
Xem chi tiết
Võ Phan Xuân Trung
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 3 2022 lúc 20:20

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,dem;

int main()

{

cin>>n;

dem=0;

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

{

cin>>x;

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

}

cout<<dem;

return 0;

}

nguyễn thị như ý
Xem chi tiết
nguyễn an phát
17 tháng 4 2021 lúc 20:09

program in_mang;

uses crt;

var i,n,max:longint;

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

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do

begin

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

end;

writeln('cac phan tu chan:');

for i:=1 to n do

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

writeln;

max:=a[1];

for i:=1 to n do

if max<a[i] then max:=a[i];

writeln('max cua day la:',max);

readln;

end.

Nguyễn Lê Phước Thịnh
19 tháng 4 2021 lúc 19:39

uses crt;

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

i,n,max: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 

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

writeln;

max:=a[1];

for i:=1 to n do

  if max<a[i] then max:=a[i];

writeln(max);

readln;

end.

 

Hồ Thị Ngọc Vy
Xem chi tiết
HT.Phong (9A5)
10 tháng 4 2023 lúc 14:27

Uses crt;

var max,min,n,i,m,n: longint;

a: array[1..100] of longint

begin clrscr;

for i:=1 to n do begin

if(a[i] mod 2=0) then m:=m+a[i];

if(a[i] mod 2<>0) then n:=n+a[i];

end;

max:=a[1];

min:=a[1];

for i:=1 to n do begin

if(max<a[i]) then max:=a[i];

if(min>a[i]) then min:=a[i];

end;

Writeln('Tong cac phan tu chan: ',m);

Writeln('Tong cac phan tu le: ',n);

Writeln('Phan tu co gia tri lon nhat: ',max);

Writeln('Phan tu co gia tri nho nhat: ',min);

readln;

end.

Hồ Thị Ngọc Vy
Xem chi tiết
HT.Phong (9A5)
11 tháng 4 2023 lúc 11:29

Uses crt;

var max,min,n,i,m,n: longint;

a: array[1..100] of longint

begin clrscr;

for i:=1 to n do begin

if(a[i] mod 2=0) then m:=m+a[i];

if(a[i] mod 2<>0) then n:=n+a[i];

end;

max:=a[1];

min:=a[1];

for i:=1 to n do begin

if(max<a[i]) then max:=a[i];

if(min>a[i]) then min:=a[i];

end;

Writeln('Tong cac phan tu chan: ',m);

Writeln('Tong cac phan tu le: ',n);

Writeln('Phan tu co gia tri lon nhat: ',max);

Writeln('Phan tu co gia tri nho nhat: ',min);

readln;

end.

Hiếu Nguyễn
Xem chi tiết
Nghị Trương Thành
9 tháng 7 2022 lúc 21:40

#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll i, j, n, a[1000005], dem = 0, m;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (i = 1; i <= n; i++)
    {
        cin >> a[i];
        if (a[i] % 3 == 0)
        {
            n--;
            i--;
        }
    }
    for (i = 1; i <= n; i++)
    {
        cout << a[i] << " ";
    }
    cout<<endl;
    for(i=1;i<=n;i++)
    {
        if(a[i]%5==0)
        {
            for(j=i;j<=n;j++)
            {
                a[j]=a[j+1];
            }
            n--;
            i--;
        }    
    }
    for(i=1;i<=n;i++)
    {
        cout<<a[i]<<" ";
    }
    return 0;
}