. Сделать в Python Дано номер року, яке вводить користувач (номер року не може бути від’ємним).
Визначити кількість днів у цьому році, враховуючи, що звичайний рік має 365 днів, а високосний 366 днів.
Високосним вважається рік, що ділиться на 4, за винятком тих років, які ділиться на 100 і не ділиться на 400
(наприклад роки 300, 1300 і 1900 не є високосними, а 1200 і 2000 є високосними).
using namespace std;
int main()
{
double a, b, c;
cout << "A = ";
cin >> a;
cout << "B = ";
cin >> b;
cout << "C = ";
cin >> c;
if (a <= b)
if (b<c)
cout << "rez = " << a*b << endl;
else cout << "rez = " << a*c << endl;
else
if (b >= c)
cout << "rez = " << c*b << endl;
else if (c>a) cout << "rez = " << a*b << endl;
else cout << "rez = " << c*b << endl;
cout << endl;
system("pause");
return 0;
}
n=10;
var
a:array[1..n] of integer;
i,_start,_end, startInd, endInd:integer;
begin
Randomize;
Write('Исходный массив: ');
_start:=-1; _end:=-1;
startInd:=-1; endInd:=-1;
for i:=1 to n do
begin
a[i]:=random (0,100);
Write(a[i],' ');
end;
Writeln;
for i:=2 to n do
begin
if a[i]>a[i-1] then
if _start > -1 then _end := i else
begin
_start := i-1;
_end := i;
end
else
begin
if (_start > -1) and ((endInd - startInd) < (_end - _start)) then
begin
startInd := _start;
endInd := _end;
end;
_start := -1;
_end := -1;
end;
end;
if startInd > -1 then
begin
Writeln('Длина диапазона: ', (endInd-startInd+1));
Write('Значения из диапазона: ');
for i:=startInd to endInd do Write(a[i],' ');
end;
end.