[Type C]Q4: Write a python program to find if a number is a happy number or not, using recursion.

What is Recursion Function?

recursive function is a function defined in terms of itself via self-referential expressions.

This means that the function will continue to call itself and repeat its behavior until some condition is met.

Problem: A happy number is a number in which the eventual sum of the square of the digits of the number is equal to 1. Write a Recursion function to check is the given number is a happy number or not.

Program Code:


It is not a happy number
It is a Happy Number

The above code demonstrates recursion in python.

To view all the lessons in chapter 6: http://computertutor.in/class-12-computer-science/chapter-6/

To view entire class 12 computer science study material: http://computertutor.in/resources/

You cannot copy content of this page