Write an assembly subroutine that checks whether a given integer is a palindrome
ID: 3833483 • Letter: W
Question
Write an assembly subroutine that checks whether a given integer is a palindrome number. For example 9 11, 1234321, 141, 1221, and 120021 are palindrome numbers. Write a C program that calls the assembly subroutine. The input is an unsigned integer. The return is 1 if the number is a p and theta if not.Explanation / Answer
class PalindromeExample{ public static void main(String args[]){ int r,sum=0,temp; int n=454;//It is the number variable to be checked for palindrome temp=n; while(n>0){ r=n%10; //getting remainder sum=(sum*10)+r; n=n/10; } if(temp==sum) System.out.println("palindrome number "); else System.out.println("not palindrome"); } }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.