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.
program TinhTongSo;
uses crt;
var
a: array [1..10] of integer;
i, tong, dem: integer;
begin
clrscr;
writeln('Nhap day 10 so nguyen: ');
for i := 1 to 10 do
begin
write('Nhap so thu ', i, ': ');
readln(a[i]);
end;
writeln('Day so da nhap tren mot hang: ');
for i := 1 to 10 do
write(a[i], ' ');
tong := 0;
for i := 1 to 10 do
if a[i] < 0 then
tong := tong + a[i];
writeln('Tong cac so nguyen am: ', tong);
dem := 0;
for i := 1 to 10 do
if (a[i] > 6) and (a[i] < 9) then
dem := dem + 1;
writeln('So luong cac so thoa dieu kien "lon hon 6 va nho hon 9": ', dem);
readln;
end.
program tinh_tong_va_dem_so_x;
const
MAX = 100;
var
a: array[1..MAX] of integer;
n, tong, x, dem, i: integer;
begin
write('Nhap so phan tu cua mang: ');
readln(n);
for i := 1 to n do
begin
write('Nhap phan tu thu ', i, ': ');
readln(a[i]);
end;
tong := 0;
for i := 1 to n do
begin
tong := tong + a[i];
end;
writeln('Tong cac phan tu trong mang la: ', tong);
write('Nhap gia tri x: ');
readln(x);
dem := 0;
for i := 1 to n do
begin
if a[i] = x then
begin
dem := dem + 1;
end;
writeln('So lan xuat hien cua ', x, ' trong mang la: ', dem);
readln;
end.
Câu 4:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if (10<a[i]) and (a[i]<20) then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So phan tu lon hon 10 va nho hon 20 la: ',dem);
writeln('Tong cac phan tu lon hon 10 va nho hon 20 la: ',t);
readln;
end.
Câu 5:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So so chan la: ',dem);
writeln('Tong cac so chan la: ',t);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 6=0 then t:=t+a[i];
writeln('Tong cac so chia het cho 3 va 6 la: ',t);
for i:=1 to n do
if a[i]>3 then write(a[i]:4);
writeln;
for i:=1 to n do
write(a[i]:4);
dem:=0;
for i:=1 to n do
if (a[i] mod 2<>0) and (a[i] mod 5=0) then inc(dem);
writeln(dem);
readln;
end.
#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;
}
Var a:array[1..200] of integer;
i,n,dem:integer;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
End;
dem:=0;
For i:=1 to n do
If a[i]>5 then dem:=dem+1;
Write('So phan tu lon hon 5 la ',dem);
Readln;
End.