Problem Solving: Application of the Sum of Digits Function

In this lesson, we’ll see an example of how a function works as a module to solve a bigger problem. Using the sum of digits function, we’ll find out the numbers that are not perfect squares.

Before we do that, let us generalize the sum of digits program so that once the sum of digits is displayed, the program must ask the user whether they want to find the sum of digits of another number or not. The program should repeat this until the user chooses not to continue.

This approach can be done on any program where a user wants to perform a task multiple times.

Get hands-on with 1200+ tech skills courses.