Write a function with the function prototype
int f(void);
that prints out n asterisks, where n represents the number of times it has been called. If it is called three times for instance, the output will be
*
* *
* * *
Test the function by calling it five times.
(A) Use a static variable inside the function.
(B) Use a global variable inside the function.
`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
A)
#include <iostream>
#include<cstdlib>
using namespace std;
int f(void)
{
static int n=1;
for(int i=0;i<n;i++)
{
cout<<"*";
}
cout<<endl;
n++;
return n;
}
int main()
{
for(int i=0;i<5;i++)
{
f();
}
return 0;
}

B)
#include <iostream>
#include<cstdlib>
using namespace std;
int n=1;
int f(void)
{
for(int i=0;i<n;i++)
{
cout<<"*";
}
cout<<endl;
n++;
return n;
}
int main()
{
for(int i=0;i<5;i++)
{
f();
}
return 0;
}

Kindly revert for any queries
Thanks.
Write a function with the function prototype int f(void); that prints out n asterisks, where n...