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.
2:
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) if (a[i]%2==0) cout<<a[i]<<" ";
return 0;
}
program mang;
uses crt;
var n,i,chan, le,max,min: Integer;
a:array[1..100] of integer;
begin
write('nhap so phan tu ');read(n);
for i:=1 to n do
begin
write('nhap so thu ',i); readln(a[i]);
end;
max:=a[1]; min:=a[1]; chan:=0;le:=0;
for i:=1to n do
begin
if a[i] > max then max:=a[i];
if a[i] < min then min:=a[i];
if a[i] mod 2 = 0 then chan:=chan+1
else le:=le+1;
end;
writeln('max la: ',max);
writeln('min la: ',min);
writeln('so phan tu chan: ',chan);
writeln('so phan tu le: ',le);
readln
end.
#include <bits/stdc++.h>
using namespace std;
int i,n;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
if (i%2==1) cout<<i<<" ";
return 0;
}
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.
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.
Program HOC24;
var a: array[1..32000] of integer;
i,max,min,n: integer;
begin
write('Nhap so phan tu N: '); readln(N);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
max:=a[1]; min:=a[1];
for i:=1 to n do
begin
if a[i]>max then max:=a[i];
if a[i]<min then min:=a[i];
end;
writeln('So nho nhat la :',max);
write('So lon nhat la: ',min);
readln
end.
uses crt;
var a:array[1..100]of integer;
i,n,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(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('So lon nhat la: ',max);
writeln('So nho nhat la: ',min);
readln;
end.
program so_le;
uses crt;
var
n,i,d:integer;
a:Array[1..32000] of integer;
begin
clrscr;
write('nhap n: ');
readln(n);
for i:= 1 to n do
begin
write('nhap a[',i,']: ');
readln(a[i]);
end;
d:=0;
for i:= 1 to n do
if a[i] mod 2 <> 0 then d:=d+1;
write('so luong so nguyen la so le la: ',d);
readln;
end.
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.
Uses crt;
var n,i: integer;
begin clrscr;
readln(n);
for i:=1 to n do if( i mod 2<>0) then write(i:3);
readln;
end.
uses crt;
var i,n:longint;
begin
writeln('nhap n'); readln(n);
for i:=1 to n do if i mod 2 =1 then
writeln(i);
readln;
end.
ngu ththế mà cũng ko làm được về lớp 1 mà học
#include <bits/stdc++.h>
using namespace std;
long long n,i;
int main()
{
cin>>n;
for (i=1; i<=n; i++)
if (i%2==1) cout<<i<<" ";
cout<<endl;
for (i=1; i<=n; i++) cout<<"chung tay day lui covid"<<endl;
return 0;
}