From 1fbf4d08bcfd8efa6eddfd9df089474a1a2ffbfe Mon Sep 17 00:00:00 2001 From: ankurgupta255 <43845288+ankurgupta255@users.noreply.github.com> Date: Sun, 28 Oct 2018 12:55:48 +0530 Subject: [PATCH] Maximum Product This is the code in C++ to return the numbers in the Array having the Maximum Product --- Algorithms/MaxPro.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Algorithms/MaxPro.cpp diff --git a/Algorithms/MaxPro.cpp b/Algorithms/MaxPro.cpp new file mode 100644 index 000000000..0b1d54e68 --- /dev/null +++ b/Algorithms/MaxPro.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; +int main() +{ + int n; + int a[100]; + int i=0; + int j=0; + int cnt=0; + int n1=0; + int n2=0; + cout<<"Enter the size of the array: "; + cin>>n; + cout<<"Enter the array Elements: "; + for(i=0;i>a[i]; + } + int pro=a[0]*a[1]; + for(i=0;ipro){ + n1=a[i]; + n2=a[j]; + pro=a[i]*a[j]; + } + } + } + cout<<"The 1st number is "<