Home > Back-end >  Pray god be solved
Pray god be solved

Time:05-16

#include
#include
Int n, r, count;
Void print (int x)
{
If (x & lt;=9)
Printf (" % d ", x);
The else
Printf (" % c ", x - 10 + 'A');
}
Void change (int n, int r)
{
If (n)
{
Change (n/r, r);
Print (n % r);
}
}
Int main ()
{
The scanf (" % d % d ", & amp; N, & amp; R);
Change (n, r);
return 0;
} in change (n/r, r);
Print (n % r); What's the meaning of, a great god answer

CodePudding user response:

Print (n % r); Print is a custom function and parameter is of type int, n % r is the result as an argument passed to the parameter; N % r assigned to the results of x

CodePudding user response:

Well, thank you, excuse me chang (n/r, r) what meaning be

CodePudding user response:

refer to the second floor m0_58034981 response:
well, thank you, excuse me and chang (n/r, r) what's the meaning of

By the same token, the results of n/r to change the first parameter n and r to the second parameter r, although is the same name in memory were independent of each other,

CodePudding user response:

reference 3 building self-confidence boy reply:
Quote: refer to the second floor m0_58034981 response:
well, thank you, excuse me and chang (n/r, r) what's the meaning of

By the same token, the results of n/r to change the first parameter n and r to the second parameter r, although is the same name in memory were independent of each other,

Thank you very much,

CodePudding user response:

Reference:
//enter a decimal number, converted to r hexadecimal number output, 
#include
#include

Int n, r, count=0;
Void print (int x)
{
If (x & lt;=9)
Printf (" % d ", x);
The else
Printf (" % c ", x - 10 + 'A');
}
Void change (int n, int r)
{
If (n)//recursion condition is: n/r!=0
{
Change (n/r, r);//recursive call
Print (n % r);
}
}
Int main ()
{
The scanf (" % d % d ", & amp; N, & amp; R);
Change (n, r);//recursive function

return 0;
}

CodePudding user response:

Thank you very much
  • Related