Answer:
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
void RandMultipByVal(int number){
srand(time(NULL));
int random = rand()%10+1;
cout<<random*number;
}
int main()
{
RandMultipByVal(4);
return 0;
}
Explanation:
Include the three libraries, iostream for input/output, stdlib.h for rand() function and time.h for srand() function.
Create the function with one integer parameter.
Then, use srand() function. It is used to seed the rand() function or locate the starting point different in different time.
rand(): it is used to generate the random number between the range.
for example:
rand()%10 it gives the random number from 0 to 9.
if we add 1, then it gives from 1 to 10.
After that, multiply with parameter value and then print the result.
For calling the function create the main function and call the function with pass by value.