Function Exercises

```Ex. 1 Sum and Product V1
Write a program that contains the following functions:
- Function that returns the sum of two given integer values
- Function that returns the product of two given integer values
- Main function to test your program as given in the following sample of
input/output.
Sample input/output
Enter first number: 10
Enter second number: 40
Sum is: 50
Product is: 400
Ex. 2 Sum and Product V2
Write a program that contains the following functions:
- Function that returns the sum of two given integer values
- Function that returns the product of two given integer values
- Main function to calculate n times the sum and product of two given
numbers as given in the following sample of input/output.
Sample input/output
Enter n: 2
Enter first number: 10
Enter second number: 40
Sum is: 50
Product is: 400
Enter first number: 5
Enter second number: 15
Sum is: 20
Product is: 75
Ex. 3 Sum and Product V3
Write a program that contains the following functions:
- Function that returns the sum of three given integer values
- Function that returns the product of three given integer values
- Main function to test your program as given in the following sample of
input/output.
Sample input/output
Enter first number: 10
Enter second number: 20
Enter third number: 40
Sum is: 70
Product is: 8000
Ex. 4 Odd/Even Checker
Write a program that contains the following functions:
- Function that returns true if a given number is odd; false otherwise.
- Main function to check n times whether a given number is odd or even. A
sample of input/output is given below.
Sample input/output
Enter n: 5
Enter a number: 7
7 is odd
Enter a number: 8
8 is even
Enter a number: 14
14 is even
Enter a number: 28
28 is even
Enter a number: 17
17 is odd
Ex. 5 Magic Number
Write a program that contains the following functions:
- Function that returns true if a given number is magic; false otherwise.
A magic number is a number in which the sum of its proper divisors
including the number itself is even.
- Main function to print all magic numbers between two given values
inclusive.
Sample of input/output
Enter first value: 7
Enter second value: 12
Magic numbers between 7 and 12 are: 7 10 11 12
Ex. 6 Digits Extraction
Write a program that contains the following functions:
- Function that returns the count of digits in a given number. For example:
o For 458, your function should return 3
o For 82687, your function should return 5
- Function that returns the count of even digits in a given number.
- Main function to test your program as given in the following sample of
input/output.
Sample of input/output
Enter a number: 82687
Count of digits in 82687 is 5
Count of even digits in 82687 is 4
Ex. 5 Printing Program
Write a program that contains the following functions:
- Function that prints all values between two given values inclusive
- Function that prints all even values between two given values inclusive
- Main function to test your program as given in the following sample of
input/output.
Sample of input/output
Enter first value: 10
Enter second value: 18
All values between 10 and 18 are: 10 11 12 13 14 15 16 17 18
All even values between 10 and 18 are: 10 12 14 16 18
```