From bed7db9127ae8e4b01e260fde9cd554dea4a92e6 Mon Sep 17 00:00:00 2001 From: ankurgupta255 <43845288+ankurgupta255@users.noreply.github.com> Date: Sun, 28 Oct 2018 12:36:14 +0530 Subject: [PATCH 1/2] Move Zeroes This is the code in C++ to "Move The Zeroes Of An Array to the End". --- Algorithms/Array/Move Zeroes to The End.cpp | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Algorithms/Array/Move Zeroes to The End.cpp diff --git a/Algorithms/Array/Move Zeroes to The End.cpp b/Algorithms/Array/Move Zeroes to The End.cpp new file mode 100644 index 000000000..79b1d9897 --- /dev/null +++ b/Algorithms/Array/Move Zeroes to The End.cpp @@ -0,0 +1,38 @@ +#include +using namespace std; +int main() +{ + int n; + int a[100]; + int i=0; + int j=n-1; + int cnt=0; + cout<<"Enter the size of the array: "; + cin>>n; + cout<<"Enter the array Elements: "; + for(int i=0;i>a[i]; + } + for(i=0;i=0;j--){ + if(a[j]!=0){ + int temp=a[i]; + a[i]=a[j]; + a[j]=temp; + break; + } + else{ + cout<<"All Elements are 0s."; + }}}} + for(i=0;i Date: Sun, 28 Oct 2018 12:55:48 +0530 Subject: [PATCH 2/2] 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 "<