Week_3 - johnelwart/Projects GitHub Wiki

Home

Homework 10: Tribonacci Sequence

Description: This program calculates and returns the tribonacci number at a given index, a tribonacci number is the sum of the previous 3 numbers in the sequence whereas a Fibonacci number is the previous 2 numbers. This program also includes a tester program that checks if the program is correct.

Input(s): Desired index

Output(s): None

Source Code

Homework 11: Two Circles

Description: This program determines if a smaller circle is inside, outside, or overlapping a larger circle using x and y coordinates as well as a radius value for both circles given by the user. The program uses the distance formula and conditional statements to determine where the smaller circle lies in regards to the larger circle.

Input(s):

  • x1, y1, r1
  • x2, y2, r2

Output(s):

  • The relationship of the two circles

Source Code

Homework 12: Arithmetic Quiz

Description: This program generates 5 random arithmetic problems using random numbers between 0 and 9 for the two operands and 0 through 2 for the operation. The 3 numbers are then passed into a function where the problem is printed to the screen, lets the user enter an answer, and then checks the users answer keeping track of how many the user got right out of 5.

Input(s): None

Output(s): The number of problems the user got right out of 5.

Source Code

Homework 13: n Choose 2

Description: This program calculates the binomial coefficient using a user defined n value. This program also has a tester program to check if the returned values are correct

Input(s): n

Output(s): None

Source Code

Lab 3: Pi Approximation

Description: This program estimates the value of pi using a pi approximation formula and a number of terms value given by the user. The approximation is then printed to the screen.

Input(s): Number of terms

Output(s): Pi approximation value

Source Code