# Adam Number or not in C Program

Adam number is a special type of number in which the square of the number is the reverse of the square of the reverse of the number. In other words, if we take the square of a number and the square of its reverse, the two results should be the same after reversing the order of the digits. For example, 12 is an Adam number because its square is 144 and the square of its reverse (21) is 441, which is the reverse of 144. Now, let's see how we can check if a given number is an Adam number or not using C programming. We will take the input number from the user and then perform the necessary operations to check if it is an Adam number.

First, we need to write a function to reverse a given number. We can do this by using the modulus operator to extract the last digit of the number and then divide the number by 10 to remove the last digit. We can repeat this process until the number becomes zero, and then concatenate the extracted digits to get the reversed number. Here is the code for the reverse function:

Next, we need to write a function to check if a given number is an Adam number or not. We can do this by first computing the square of the number and its reverse using the pow() function from the math.h library and the reverse() function that we just defined. We can then compare the two results and check if they are the same after reversing the digits. Here is the code for the Adam number function:

Now, we can use the isAdamNumber() function to check if a given number is an Adam number or not. Here is the complete C program to do this:

In this program, we first take the input number from the user and then call the isAdamNumber() function to check if it is an Adam number or not. If it is an Adam number, we print a message saying so, and if it is not, we print a message saying that it is not an Adam number.

In conclusion, an Adam number is a number whose square is the reverse of the square of its reverse. We can check if a given number is an Adam number or not using the C program that we just discussed

Output

```12
5
```

Explanation:

The reverse() function takes an integer as input and returns the reversed integer. It works by using a while loop to extract the last digit of the input integer using the modulus operator % and then remove the last digit using integer division by 10. The extracted digits are then concatenated in reverse order to form the reversed integer.

The isAdamNumber() function takes an integer as input and returns 1 if it is an Adam number and 0 otherwise. The function first calculates the square of the input integer and the square of its reverse using the pow() function from the math.h library and the reverse() function. It then calculates the reverse of the square of the reverse using the reverse() function again. Finally, it compares the square of the input integer with the reverse of the square of the reverse, and returns 1 if they are equal and 0 otherwise.

Next TopicAdd 2 Matrix in C

### Feedback   