Answer:
Returned value: 2
Explanation:
Public int f(int k, int n) {
if (n == k)
return k;
else if (n > k)
return f(k, n - k);
else return f(k - n, n);
}
/////////////////////////////////////////////////////////////////////////////////////////
Trace of function calls,
f(6, 8)
f(k, n - k) -> (6, 2)
f(k - n, n) -> (4, 2)
f(k - n, n) -> (2, 2)
return k
Answer:
#include <iostream>
using namespace std;
int main()
{
int input = 0;
int count = 0;
int sum = 0;
int sumNegative = 0;
while (true) {
cout << "Enter a number: ";
cin >> input;
if (input == 0) break;
count++;
sum += input;
if (input < 0) {
sumNegative += input;
}
}
cout << "Count of the numbers: " << count << endl;
cout << "Sum of all the numbers: " << sum << endl;
cout << "Sum of the negative numbers: " << sumNegative << endl;
}
Explanation:
Your requirements regarding the sum and the negative numbers was a bit vague so I just did something you can probably adjust easily to your liking.
Answer:
The main physical components of cloud infrastructure are networking equipment, servers and data storage