In Homework 4, we wrote a program capable of checking if the input is a prime number. Please rewrite this program with function and pointer. You have to use at lease one function and one pointer.
Hint: You might need mod (%), which gives you the reminder of a division. Use the C++ manual to find more about mod or %.
Example:
10 % 3 =1
234 % 7 =3
**************************
Example Input 1:
What do you want to know? 7
Example Output 1:
It is a prime number.
Example Input 2:
What do you want to know? 121
Example Output 2:
It is a composite number.
**************************
In Homework 6, we wrote a program capable of calculating BMI value and checking if someone is underweight, normal weight, over weight or obese. Please rewrite this program with function an Pointer. Please notice that calculating and checking BMI should be in different functions. You have to use at lease one function and one pointer.
BMI=(weight; pounds) x 703 / (height; inches) ^ 2
BMI<=18.5: Underweight
24.9>BMI>18.5: Normal weight
25>BMI>29.9: Overweight
BMI>30: Obesity
**************************
Example Input :
10
1 150 70
2 155 71
3 160 69
4 175 80
5 180 65
6 183 62
7 173 69
8 172 73
9 165 72
10 177 75
Example Output:
There are 10 faculty being examined.
Faculty #5 is overweight. The BMI is 29.950
Faculty #6 is obese. The BMI is 33.467
Faculty #7 is overweight. The BMI is 25.545
**************************