1) Make a program that will determine whether the given number is even or not.
Sample Output
Input a number: 2
2 is an even number
3 is not an even number
2)Make a program that will determine whether the given number is odd or not
Sample Output:
Input a number: 1
1 is an odd number
2 is not an odd number
I would have to say this is probably the easiest exam you will ever get and is probably the exam after a week or two of the course :P Or your teacher is teaching very slow.
Though I guess another approach would be to see if when it divides by 2 it doesn't have a remainder. By not having a remainder I mean 2.0 instead of 2.1 or 5.0 instead of 5.5. I think either that method or checking the first bit with bitwise and (&) would be the most effective. Compared to brute force dividing by 2 as many times as possible(while > 1) or using modulus.