Three Homework Problems
August 4, 2015
I get lots of emails, and even some comment postings, from students whe want help with their homework. I never respond, even to offer a hint or a simple word of encouragement. Sorry, but that’s not what I do. But many of my exercises are based on typical homework problems for programming students, and with a new academic year about to start, I figure now is a good time to write some typical homework exercises.
1. Write a function that takes as input three positive integers and finds the sum of the squares of the two largest of the three.
2. Write a function that takes a positive integer as input and determines if it is a base-10 palindrome.
3. Write a function that takes a positive integer as input and determines the number of trailing zeroes in the output of that number’s factorial.
Your task is to write the three requested functions in the manner of a beginning programming student. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.
Pages: 1 2