// PascalABC.NET 3.6.3
uses School;
function Divizors(n: integer): List<integer>;
begin
var L := new List<integer>;
L.Add(1);
L.Add(n);
if n > 3 then
begin
var k := 2;
while (k * k <= n) and (k < 46341) do
begin
if n mod k = 0 then
begin
var t := n div k;
L.Add(k);
if k < t then L.Add(t)
else break
end;
Inc(k)
end;
L.Sort;
end;
Result := L
end;
begin
// 1
if ReadInteger.IsPrime then Println('YES')
else Println('NO');
// 2
ReadInteger.Factorize.First.Println;
// 3
var a := Divizors(ReadInteger);
Print(a.Count, a.Sum)
end.
#include <iostream>
#include <cmath>
#include <ctime>
using namespace std;
int main (void)
{
srand (time (0));
int Temp = 0;
int max = 1;
int maxi = 0;
int n = 0;
cout << "Input n = ";
cin >> n;
cout << endl;
int *A = new int[n];
for (int i = 0; i < n; i++)
{
A[i] = -10 + rand () % 30;
cout << A[i] << " ";
}
for (int i = 0; i < n; i++)
{
if (abs (A[i]) > abs (max))
{
max = A[i];
maxi = i;
}
}
cout << "\nABS(Max) = " << max << " Number = " << maxi;
Temp = A[n - 1];
A[n - 1] = max;
A[maxi] = Temp;
cout << endl;
for (int i = 0; i < n; i++)
{
cout << A[i] << " ";
}
delete[]A;
}
Объяснение:
24=«--_--0{}]<:**#'"21" _"