(10%)
Determine whether the following code is correct or not. If it is
correct, predict its output. If it is incorrect, point out the
mistake(s).
// Function prototype
#include <iostream>
using std::cout;
using std::endl;
void print_stars(int n); // Function prototype
int main()
{
int i;
const int MAX = 5;
for (i=1; i<=2*MAX-1; i++)
{
print_stars( i<=MAX ? i : 2*MAX-i);
}
return 0;
}
void print_stars(int n) // Function to print n stars
{
int j;
for (j=0; j<n; j++)
cout << '*';
cout << endl;
return;
}