1) если нужно найти произведение элементов с нечетными индексами:
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
signed main() {
int a[20];
srand(time(NULL));
for(int i = 0; i < 20; i++)
a[i] = rand()%46 - 19;
for(auto i: a)
cout << i << " ";
cout << "\n";
long long ans = 1;
for(int i = 0; i < 20; i++)
if(i % 2 == 1)
ans *= a[i];
cout << ans;
}
2) Если нужно найти произведение элементов с нечетными порядковыми номерами:
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
signed main() {
int a[20];
srand(time(NULL));
for(int i = 0; i < 20; i++)
a[i] = rand()%46 - 19;
for(auto i: a)
cout << i << " ";
cout << "\n";
long long ans = 1;
for(int i = 0; i < 20; i++)
if((i+1) % 2 == 1)
ans *= a[i];
cout << ans;
}
var x: integer;s, k: char;
begin
k := chr(233);
while s <> k do
begin
write('Введите символ: ');
readln(s);
x := ord(s);
writeln('Код символа: ', x);
end;
end.
Вариант №2
var x, k: integer;
begin
k := 233;
for x:= 1 to k do
writeln('Код символа ', chr(x), ': ', x);
end.