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.

Var a:array[1..100] of integer;
i,n:integer;
begin
write('Nhap so luong so nguyen trong mang ');readln(n);
for i:=1 to n do
begin
write('nhap phan tu thu ',i,' ');readln(a[i]);
end;

#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,k,t=0,x;
cin>>n>>k;
for (int i=1; i<=n; i++)
{
cin>>x;
if (x%k==0) t=t+x;
}
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,k,t=0,x;
cin>>n>>k;
for (int i=1; i<=n; i++)
{
cin>>x;
if (x%k==0) t=t+x;
}
cout<<t;
return 0;
}

Đoạn chương trình nhập vào dãy số nguyên gồm N phần tử nhập từ bàn phím
n = int(input("Nhập số phần tử của dãy: "))
a = [ ]
for i in range(n):
a.append(int(input("Nhập phần tử thứ {0}: ".format(i+1))))

#include <bits/stdc++.h>
using namespace std;
long long n,i,a[1000];
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
sort(a+1,a+n+1);
for (i=n; i>=1; i--) cout<<a[i]<<" ";
return 0;
}


program TinhTBCTimSoNT;
var
ten, lop: string;
n, i, tong, dem: integer;
A: array [1..11] of integer;
trung_binh: real;
function LaSoNguyenTo(x: integer): boolean;
var
i: integer;
begin
if x < 2 then
LaSoNguyenTo := false
else if x = 2 then
LaSoNguyenTo := true
else if x mod 2 = 0 then
LaSoNguyenTo := false
else
begin
i := 3;
while (i <= trunc(sqrt(x))) and (x mod i <> 0) do
i := i + 2;
LaSoNguyenTo := x mod i <> 0;
end;
end;
begin
// Nhập tên và lớp của học sinh
write('Nhập tên của học sinh: ');
readln(ten);
write('Nhập lớp: ');
readln(lop);
// Nhập dãy số nguyên và tính trung bình cộng
repeat
write('Nhập số phần tử của dãy số (n<12): ');
readln(n);
until n < 12;
tong := 0;
for i := 1 to n do
begin
write('Nhập phần tử thứ ', i, ': ');
readln(A[i]);
tong := tong + A[i];
end;
trung_binh := tong / n;
// In tên, lớp, dãy số và trung bình cộng ra màn hình
writeln('Học sinh: ', ten);
writeln('Lớp: ', lop);
write('Dãy số: ');
for i := 1 to n do
write(A[i], ' ');
writeln;
// In các số nguyên tố của dãy số ra màn hình
writeln('Các số nguyên tố của dãy số:');
for i := 1 to n do
if LaSoNguyenTo(A[i]) then
writeln(A[i]);
end.

uses crt;
var i,n,x,t:integer;
a:array[1..100]of integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do
if a[i] mod 10=7 then write(a[i]:4);
readln;
end.

#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,A[100];
cin>>n;
for (int i=1; i<=n; i++)
cin>>A[i];
for (int i=1; i<=n; i++)
cout<<A[i]<<" ";
return 0;
}

uses crt;
var n,i,k,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 2=0 then inc(dem);
writeln('So phan tu chan trong day so la: ',dem);
write('Nhap so k='); readln(k);
kt:=0;
for i:=1 to n do
if a[i]=k then kt:=i;
if kt=0 then writeln('Khong co phan tu nao trong day bang ',k)
else writeln('Trong day co phan tu bang ',k);
readln;
end.
Var a:array[1..100] of integer;
i,n:integer;
begin
write('Nhap so luong so nguyen trong mang ');readln(n);
for i:=1 to n do
begin
write('nhap phan tu thu ',i,' ');readln(a[i]);
end;
readln;
end.