86. Change a Value Through a Pointer
Foundation1000 ms256 MBSolved by 0%
Read an integer, then use a function to multiply it by three in place, and print the result.
The function must change the caller's variable rather than returning a new value. In C and C++ that means a pointer; in other languages, an array or another mutable holder.
Constraints - `-1000000000 ≤ n ≤ 1000000000`
Input
A single line containing one integer n.
Output
Print one integer, the value after the function has changed it.
Input5
Output15
Notetriples a small positive value
Input-4
Output-12
Notetriples a negative value
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.