In return to his kindness and compassion, I want to give him a gift. I'm thinking of giving him straight up cash! I've already prepared something in advance, I just need your help to complete it. Instructions: In the code editor, you are provided with a main() function that asks for an integer input from the user which represents the cash to be given to Lionel and passes it to the getGift() fu
6. FORGIVEN!! (C
by CodeChum Admin
Yeeey!! Thanks to your help, my friend Lionel Richie forgave me!
In return to his kindness and compassion, I want to give him a gift. I'm thinking of giving him straight up cash!
I've already prepared something in advance, I just need your help to complete it.
Instructions:
In the code editor, you are provided with a main() function that asks for an integer input from the user which represents the cash to be given to Lionel and passes it to the getGift() function call.
The getGift() function is already declared and partially defined. Your task is to complete the function definition.
The getGift() function multiplies the passed integer value by 3 and then checks if the result is even. If it is, the getGift() function adds 100 to the result. Otherwise, it adds 200 to the result. The getGift() function would then return the result as the return type of this function is int.
Input
1. Cash amount
Output
Enter cash amount: 1000
I'm giving you P3100
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images