Question #49714

Write the following program:

A. Write a value‐returning function called length() that takes a positive integer and returns the number of digits in that integer.

B. Using the written function in part A, write a value‐returning function called isPalindrome() that checks if a positive integer is a palindrome or not. A number is palindrome if it reads the same left to right and right to left. For example 23432 is a palindrome, while 5675 is not palindrome. The function takes a positive integer and returns true if the integer is a palindrome and false otherwise.

Test your functions by writing a main function that prompts the user to input an integer and outputs its number of digits and "It Is a Palindrome" message if it is a palindrome, otherwise "It Is not a Palindrome".

A. Write a value‐returning function called length() that takes a positive integer and returns the number of digits in that integer.

B. Using the written function in part A, write a value‐returning function called isPalindrome() that checks if a positive integer is a palindrome or not. A number is palindrome if it reads the same left to right and right to left. For example 23432 is a palindrome, while 5675 is not palindrome. The function takes a positive integer and returns true if the integer is a palindrome and false otherwise.

Test your functions by writing a main function that prompts the user to input an integer and outputs its number of digits and "It Is a Palindrome" message if it is a palindrome, otherwise "It Is not a Palindrome".

Expert's answer

``

## Comments

## Leave a comment