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
Nguyễn Ngọc
Xem chi tiết
Nguyễn Phúc
Xem chi tiết
Nguyễn Lê Phước Thịnh
19 tháng 5 2021 lúc 9:57

uses crt;

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

i,n,t1,t2,t3:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

t1:=0;

for i:=1 to n do 

  if a[i]<0 then t1:=t1+a[i];

writeln('Tong cac so am la: ',t1);

t2:=0;

for i:=1 to n do 

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

writeln('Tong cac so chia het cho 2 la: ',t2);

t3:=0;

for i:=1 to n do 

  if (a[i]>0) and (a[i] mod 3=0) then t3:=t3+a[i];

writeln('Tong cac so duong chia het cho 3 la: ',t3);

readln;

end.

Hải Hà
Xem chi tiết
Minh Lệ
6 tháng 4 2023 lúc 22:49

Bài 1:

Program HOC24;

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

i,n,d: integer;

begin

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

for i:=1 to n do 

begin

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

end;

for i:=1 to n do if (a[i]<0) and (a[i] mod 2=0) then d:=d+1;

write('Co ',d,' so nguyen am chan trong day so');

readln

end.

Minh Lệ
6 tháng 4 2023 lúc 22:54

Bài 2:

Program HOC24;

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

i,n: integer;

t: longint;

begin

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

for i:=1 to n do 

begin

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

end;

t:=0;

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

write(Tong la: ',t);

readln

end.

Minh Lệ
6 tháng 4 2023 lúc 22:55

Bài 3:

Program HOC24;

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

i,n: integer;

t: longint;

begin

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

for i:=1 to n do 

begin

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

end;

t:=1;

for i:=1 to n do if (a[i] mod 2=0) then t:=t*a[i];

write('Tich la: ',t);

readln

end.

Thu hằng
Xem chi tiết
Nguyễn Lê Phước Thịnh
11 tháng 11 2021 lúc 23:40

#include <bits/stdc++.h>

using namespace std;

long long n,i,x;

int main()

{

cin>>n;

long long t=0;

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

{

cin>>x;

if (x%3==0) t=t+x;

}

cout<<t;

return 0;

}

Năm Nguyễn thị
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 3 2023 lúc 14:59

#include <bits/stdc++.h>

using namespace std;

int n,A[1000],i,dem=0,t=0;

int main()

{

cin>>n;

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

cin>>A[i];

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

{

if (A[i]%3!=0) dem++;

if (A[i]%4==2) t+=A[i];

}

cout<<dem<<endl;

cout<<t;

return 0;

}

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

Hoàng Thùy
Xem chi tiết
Kiều Vũ Linh
13 tháng 3 2023 lúc 7:35

Var so,n,i:integer;

s:longint;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap so thu ',i,' = ');readln(so);

If (so mod 3 = 0) and (so mod 5 = 0) then

s:=s+so;

End;

Write('Tong la ',s);

Readln;

End.

V.Lộc
Xem chi tiết
Hải Hà
Xem chi tiết