Write the definition of a function oneLess , which receives an integer parameter and returns an integer that is one less than the value of the parameter . So if the parameter ‘s value is 7, the function returns the value 6. If the parameter ‘s value happens to be 44, the functions returns the value 43.

Write the definition of a function oneLess , which receives an integer parameter and returns an integer that is one less than the value of the parameter . So if the parameter ‘s value is 7, the function returns the value 6. If the parameter ‘s value happens to be 44, the functions returns the value 43.

LANGUAGE: C++

CHALLENGE:

Write the definition of a function oneLess , which receives an integer parameter and returns an integer that is one less than the value of the parameter . So if the parameter ‘s value is 7, the function returns the value 6. If the parameter ‘s value happens to be 44, the functions returns the value 43.

SOLUTION:


int oneLess(int amount){
   return amount - 1;
}

Add comment