Возможный вариант в C++ #include <iostream> int main() { using namespace std; int N; cout << "Enter N: "; cin >> N; int num; int max = 1; int i; for (i = 0; i < N; ++i) { cout << "Enter #" << i + 1 << " number: "; cin >> num; if ((num - 9) % 10 != 0 && num % 3 == 0) { max = num; break; } } for (int j = i + 1; j < N; ++j) { cout << "Enter #" << j + 1 << " number: "; cin >> num; if ((num - 9) % 10 != 0 && num % 3 == 0) if (num > max) max = num; } if (max != 1) cout << "Max number div by 3 and don't end 9: " << max << endl; else cout << "No numbers div by 3 and don't end 9" << endl; return 0; }
#include <iostream>
int main()
{
using namespace std;
int N;
cout << "Enter N: ";
cin >> N;
int num;
int max = 1;
int i;
for (i = 0; i < N; ++i)
{
cout << "Enter #" << i + 1 << " number: ";
cin >> num;
if ((num - 9) % 10 != 0 && num % 3 == 0)
{
max = num;
break;
}
}
for (int j = i + 1; j < N; ++j)
{
cout << "Enter #" << j + 1 << " number: ";
cin >> num;
if ((num - 9) % 10 != 0 && num % 3 == 0)
if (num > max)
max = num;
}
if (max != 1)
cout << "Max number div by 3 and don't end 9: " << max << endl;
else
cout << "No numbers div by 3 and don't end 9" << endl;
return 0;
}
1)program p1;
var m,n: integer;
begin
write('вводите число: '); readln(n);
if n> =100 then
begin
m: = n mod 10;
writeln('последняя цира: ',m);
m: =n div 10 mod 10;
writeln('предпоследняя цира: ',m);
end;
end.
2)program p2;
var t1,t2,t3,d1,d2,d3,v1,v2,v3: integer;
vsr: real;
begin
write('вводите время езды(ч): '); readln(t1,t2,t3);
write('вводите скорость(км/ч): '); readln(v1,v2,v3);
d1: =v1*t1;
d2: =v2*t2;
d3: =v3*t3;
vsr: =(d1+d2+d3)/(t1+t2+t3);
writeln('средяя скорость= ',vsr: 1: 2,'км/ч');
end.