Name: ____________________________________________________ Alpha: _____________________
Describe help received: _________________________________________________________________
#include <iostream>
using namespace std;
int main() {
int i = 1;
while( i <= 10 ) {
int sum = 0;
sum = sum + i;
}
cout << sum << endl;
return 0;
}
Why doesn't this program compile? Explain below why it doesn't compile as is (not how to fix it). Then annotate the code above to show how to fix this error (and any other errors) so that the program both compiles and works properly.
$ ./product Enter two integers: 2 5 Product of all integers between 2 and 5 is 120 $ ./product Enter n: 10 13 Product of all integers between 10 and 13 is 17160 $ ./product Enter n: 1 12 The product of all integers between 1 and 12 is 479001600
$ ./product Enter two integers: 1 13Why do you think your program outputs the result incorrectly?