Fermat’s Last Theorem

Exercise 5.2. Fermat’s Last Theorem says that there are no positive integers a, b, and c such thatan + bn = cnfor any values of n greater than 2.1. Write a function named check_fermat that takes four parameters—a, b, c and n—andchecks to see if Fermat’s theorem holds. If n is greater than 2 andan + bn = cnthe program should print, “Holy smokes, Fermat was wrong!” Otherwise the program shouldprint, “No, that doesn’t work.”2. Write a function that prompts the user to input values for a, b, c and n, converts them tointegers, and uses check_fermat to check whether they violate Fermat’s theorem.

SAMPLE ASSIGNMENT
Powered by WordPress