Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The below code is giving me errors, any help would be appreciated. #include #include using namespace std; int arraysum(int arr[], int n) { if (n
The below code is giving me errors, any help would be appreciated.
#include
using namespace std;
int arraysum(int arr[], int n) { if (n<0) return 0;
else return (arr[n]+arraysum(arr, n-1));
}
int main() { int array[100], sum=0, n;
cout << "Enter the Value of N"; cin >> n;
cout << endl << "Enter the Values into the array"; for (int i=0; )
cin>> array[i];
sum=arraysum(array, n-1);
cout << "Sum of Array is:" << sum << endl;
system("PAUSE"); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started