Test 1 Practice

Format of Tests

Format of tests may contain any of these three main types of problems

Some Practice Coding Problems

  1. Write a program that asks the user to enter three integers, then computes their decimal average and prints the result
  2. Write a function that takes in three integer parameters and returns their decimal average. (How does this differ from the previous problem?)
  3. Write a function that takes in two integer parameters and returns true if the first parameter is a multiple of the second, and false otherwise. (Hint: The % operator can help you determine factors and multiples)
  4. Write a function that takes in three integer parameters and decides if they could be the lengths of the sides of a right triangle. If so, return true. Otherwise, return false. (Hint: Pythagoras had a little theorem, it's hypothesis was white as snow...)
  5. Write a program that has the user enter the radius of a circle, then compute and print the diameter, the circumference, and the area. Use the value 3.14159 for pi.
  6. Write a function that takes in two integer parameters, x and y, and computes and returns x raised to the y power. Do this without using any <cmath> library functions
  7. Write a function that takes in a positive integer parameter N, and then returns the sum of all the positive numbers that are less than or equal to N. (i.e. add up all numbers from 1 through N -- you'll need a loop).
  8. Write a function that does the same as the previous exercise, but adds up only the odd numbers from 1 to N
  9. Write a function that takes in three double parameters and returns the smallest of the three values
  10. Write a function that takes in three integer parameters and returns true if they are all even numbers, and false otherwise