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.
uses crt;
var a:array[1..100]of integer;
i,n,dem: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 (10<a[i]) and (a[i]<20) then inc(dem);
writeln(dem);
readln;
end.
Chương trình đầy đủ:
uses crt;
var n,i:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
if n mod i=0 then write(i:4);
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.
program Le_Nho_Hon_Hoac_Bang_n;
uses crt;
var
n, i: integer;
begin
clrscr;
write('Nhap vao mot so nguyen duong n: ');
readln(n);
while n <= 0 do
begin
writeln('So ban nhap khong hop le. Xin vui long nhap lai: ');
readln(n);
end;
clrscr;
writeln('Cac so le nho hon hoac bang ', n, ' la:');
i := 1;
while i <= n do
begin
if i mod 2 <> 0 then
writeln(i);
i := i + 1;
end;
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) if (i%3==0) cout<<i<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[10000],i,n,dem;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
dem=0;
for (i=1; i<=n; i++)
if (a[i]%3==0)
{
cout<<a[i]<<" ";
dem++;
}
cout<<endl;
cout<<dem;
return 0;
}
a)
var a:array[1..100] of longint;
n,i,max,d:longint;
begin
read(n);
for i:=1 to n do
write('nhap chieu cao, don vi cm');read(a[i]);
b) max:=a[1];
for i:=2 to n do
if a[i]>max then max:=a[i];
writeln('ban cao nhat cao',max);
c) for i:=1 to n do
if a[i]>160 then d:=d+1;
write('so ban cao hon 160 cm la: ',d);
end.
program Tim_So_Le_Chia_Het_Cho_3;
uses crt;
var
n, i, count: integer;
begin
clrscr;
write('Nhap vao mot so nguyen duong n: ');
readln(n);
writeln('Cac so le chia het cho 3 nho hon ', n, ' la: ');
count := 0;
for i := 1 to n do
begin
if (i mod 2 = 1) and (i mod 3 = 0) then
begin
writeln(i);
count := count + 1;
end;
end;
writeln('Co tat ca ', count, ' so le chia het cho 3');
readln;
end.