Computer Science, asked by mustafaalbudairi, 30 days ago

Given an array of integers, find the pair of adjacent elements that has the largest product and return that product. in c++

Answers

Answered by bahriatimes
0

Explanation:

#include <iostream>

using namespace std;

main()

{

int n;

cout<<"Enter size of array";

cin>>n;

int array[n]

for(int i=0;i<n;i++)

{

cin>>array[i] ;

}

int adjacentElementsProduct(int arr1[] )

{

int arr = inputArray;

int x=0;

int y=0;

int p=0;

for(int i=0;i<n;i++)

{

x=arr[i];

y=arr[i+1];

if(x*y>p){

p=x*y;

}

}

cout <<endl<<"Largest value ="<<p;

}

}

Similar questions