{
Int the product;
Int multiplication1A=rand () % 10;
Int multiplication1B=rand () % 10;//set up two random number
The product=multiplication1A * multiplication1B;
Printf (" % d % d *=? The \ n ", multiplication1A, multiplication1B);//print issue
}
If I want to get the product value, how to do
CodePudding user response:
Int multiplication1 (){
//...
Return the product.
}
CodePudding user response:
int multiplication1 ()
{
Int the product;
Int multiplication1A=rand () % 10;
Int multiplication1B=rand () % 10;//set up two random number
The product=multiplication1A * multiplication1B;
Printf (" % d % d *=? The \ n ", multiplication1A, multiplication1B);//print issue
Return the producet;
}
Method 1
void multiplication1 (int * output)
{
Int the product;
Int multiplication1A=rand () % 10;
Int multiplication1B=rand () % 10;//set up two random number
The product=multiplication1A * multiplication1B;
Printf (" % d % d *=? The \ n ", multiplication1A, multiplication1B);//print issue
* the output=the product;
}
Method 2
Pay attention to method 2 need to pass the address of a variable of type int,
CodePudding user response: