By Subalaxmi C

To find if a number if a given number is a rare number or not in C++ with the help of functions.

A rare number is an integer A which needs to be a non-palindromic number and the sum and the difference of the given integer and the reversed integer must be perfect squares.

First, we need to ask the user to enter an integer then we need to check if the given value is a palindrome or a non-palindrome integer. If it is a palindromic number we need to request the user to enter a value again.

If we succeed in the previous step i.e. the given integer being a non-palindromic value. We create a function call where the given integer and the reversed integers are passed.

In the called function we get the sum and difference of the respective integers and we get their square roots using the function 'sqrt()'.

Then 'floor()' function is used to get the largest possible integer which is less than or equal to the given integer. With the statement#13 and #16, we can see the use of the function.

Then we use '&&' operator to compare both the sum and difference if they are 0 or 1.

If the outcome is 0 then the entered number is not a rare number. Else it is a rare number.

Submitted by Subalaxmi C (SubaChidambaram)

- Steganography in Python
- convert XML to json in Java
- Simple library system using classes using Python
- Generate One-time-password (OTP) using Java
- Love-Calculator-in-Python
- How to get specific element from the XORinacci Series in minimum time complexity in Java
- Travelling Salesman Problem using AI Genetic Algorithm in C++
- Basic Calculator using Tkinter in Python

Download packets of source code on Coders Packet

## Comments