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
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
World Languages,
15 days ago
Math,
15 days ago
Math,
30 days ago
Psychology,
30 days ago
Hindi,
8 months ago
Physics,
8 months ago