Program zadacha;vara: array[1..1000] of integer;i,n,sum_pol,sum_otr: integer;beginwriteln('vvedite kol-vo elementov massiva');readln(n);for i:=1 to n do begina[i]:=random(1000)-500;write(a[i]:6);end; sum_pol:=0;sum_otr:=0;for i:=1 to n do beginif a[i]>0 then sum_pol:=sum_pol+a[i];end;writeln();writeln('udvoennaya summa polojit. chisel = ', sum_pol*2); for i:=1 to n do beginif (a[i]<0) and (i mod 2 <> 0) then sum_otr:=sum_otr+a[i];end; writeln('summa otricat. i nechetn. chisel = ', sum_otr);end.
sum_pol:=0;sum_otr:=0;for i:=1 to n do beginif a[i]>0 then sum_pol:=sum_pol+a[i];end;writeln();writeln('udvoennaya summa polojit. chisel = ', sum_pol*2);
for i:=1 to n do beginif (a[i]<0) and (i mod 2 <> 0) then sum_otr:=sum_otr+a[i];end;
writeln('summa otricat. i nechetn. chisel = ', sum_otr);end.
#include <iostream>
using namespace std;
int k=2;
bool StrangeSeq(int n){
if (k<n){
if(n%k==0){
cout<<"false";
return false;
}
k++;
StrangeSeq(n);
}
else
{
cout<<"true";
return true;
}
}
int main(){
int n;
cin>>n;
StrangeSeq(n);
cin.get();
cin.get();
}