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;
}
begin
write('a=');
readln(a);
write('b=');
readln(b);
write('c=');
readln(c);
p:=a+b+c;
writeln('Периметр треугольника = ', p:8:3);
end.