Answer:
Function:
int fun(int n,char c) // function definition with a two argument in which variable n is a integer type and variable c is a character type.
{
while(n>0)// while loop
{
printf("%c",c); // print statement for character
n--; // decrease statement to false the loop.
}
return 0; //return statement.
}
output:
- When the user pass n=5 and c='a', it will prints 5 times 'a' character.
- When the user passes n=10 and c='t', it will print 10 times 't' character.
Step-by-step explanation:
- Firstly we declare a function of two arguments in which variable n is an integer type and variable c is a character type.
- Then in the function body, we use while loop from n times iteration because question demands to print n time any character.
- Then in the loop body, we use a print statement to print a character and a decrease statement to false the loop after a finite iteration.