Question: A numeric palindrome is a number whose digits read the same both forwards and backwards. For example, the number 12536 is NOT a palindrome, because
A numeric palindrome is a number whose digits read the same both forwards and backwards. For example, the number 12536 is NOT a palindrome, because if you reverse the digits, the result is 63521. However, the number 5126215 is a palindrome because it looks the same when the digits are reversed. Other examples: 42 and 534 are not palindromes, 22 and 7337 are palindromes. a) You will store the digits of the number as elements of an array. The array is stored inside a C structure. Define a structure type named digitarray. The members of this structure are: 1) an integer array variable of maximum length 50, and 2) an integer variable that tells you the number of digits stored in the array. For example, if you wanted to declare a variable named x to hold the number 12754, it might look like this: your_data_type x = {(1, 2, 7, 5, 4), 5};//structure variable to hold five-digit number b) Write a function named ispal that determines if a number (whose digits arc stored in an array) is a palindrome or not. The input argument to the function is a variable of the data type you defined in Part (a). The function should use a return statement to return a 0 (or boolean false) if the number is NOT a palindrome. Otherwise, it should return a 1 (or boolean true). Use a for loop to step through the digits stored in the array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
