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 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.
1)
Var array:[1..1000] of integer;
i,n,t:integer;
Begin
Write('n = ');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] > a[i+1] then
Begin
t:=a[i];
a[i]:=a[i+1];
a[i+1]:=t;
End;
Write('Sap xep tang dan ');
For i:=1 to n do write(a[i]:8);
Readln
End.
2)
Var array:[1..1000] of integer;
i,n,t:integer;
Begin
Write('n = ');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] < a[i+1] then
Begin
t:=a[i];
a[i]:=a[i+1];
a[i+1]:=t;
End;
Write('Sap xep giam dan ');
For i:=1 to n do write(a[i]:8);
Readln
End.
#include <bits/stdc++.h>
using namespace std;
long long i,n,kt,j;
int main()
{
cin>>n;
for (i=2; i<=n; i++)
{
kt=0;
for (j=2; j*j<=i; j++)
if (i%j==0) kt=1;
if (kt==0) cout<<i<<" ";
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int n;
cout << "Nhap vao mot so nguyen khong am: ";
cin >> n;
int count = 0;
for (int i = n + 1; i <= n * n; i++) {
if (i > 0) {
count++;
}
}
cout << "So luong so duong lon hon " << n << " va nho hon hoac bang " << n * n << " la: " << count << endl;
return 0;
}
{program bt_1;
uses crt;
Var:S ,n, i, j:longint;
Begin
clrsr;
Write('Nhap n');Readln(n);
For i:=1 to n do
Begin
S:=0;
For j:=0 to i do
if i mod j:=0 then S:=S+j;
if S=2*i then Write (i:5);
end;
readln;
end.
}
Var a:array[1..1000] of integer;
i,m,tam:integer;
Begin
Write('m = ');readln(m);
For i:=1 to m do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
End;
For i:=1 to m do
If a[i] < a[i+1] then
Begin
tam:=a[i];
a[i]:=a[i+1];
a[i+1]:=tam;
End;
Write('Mang sau khi sap xep: ');
For i:=1 to m do
Write(a[i]:8);
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;
}
uses crt;
var i,n:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
if i mod 2=1 then write(i:4);
for i:=1 to n do
if i mod 2=0 then write(i:4);
readln;
end.
giúp mình với
uses crt;
var i:integer;
begin
clrscr;
for i:=20 downto 1 do
write(i:4);
readln;
end.