👤

Cum scriu problema asta in c++ ?" Se citeste un vector de la tastatura . Calculati :S=a[0]*a[1]+a[1]*a[2] + ... + a[n-2]*a[n-1]"

Răspuns :

#include<iostream>
using namespace std;
int main ()
{int s=0, a[100][100], i, n;
cout <<"n="; cin>>n;
for(i=0;i <n-1;i++)
s=a[i]*a [i+1]+s;
cout <<"s="<<s;
return 0;}