pseudo code for palindrome number
Answers
Answer:
n=int(input("Enter number:")) temp=n rev=0 while(n>0): dig=n%10 rev=rev*10+dig n=n//10 if(temp==rev): print("The number is a palindrome!") else: print("The number isn't a palindrome!") 1. User must first enter the value of the integer and store it in a variable.
pls mark as brainliest
all by own written....
Answer:
Here is source code of the Python Program to check whether a given number is a palindrome
n=int(input("Enter number:"))
temp=n
rev=0
while(n>0):
dig=n%10
rev=rev*10+dig
n=n//10
if(temp==rev):
print("The number is a palindrome!")
else:
print("The number isn't a palindrome!")
Runtime Test Cases:-
Case 1
Case 1Enter number:121
Case 1Enter number:121The number is a palindrome!
Case 1Enter number:121The number is a palindrome!
Case 1Enter number:121The number is a palindrome! Case 2
Case 1Enter number:121The number is a palindrome! Case 2Enter number:567
Case 1Enter number:121The number is a palindrome! Case 2Enter number:567The number isn't a palindrome!
Explanation:-
1. User must first enter the value of the integer and store it in a variable.
1. User must first enter the value of the integer and store it in a variable.2. The value of the integer is then stored in another temporary variable.
1. User must first enter the value of the integer and store it in a variable.2. The value of the integer is then stored in another temporary variable.3. The while loop is used and the last digit of the number is obtained by using the modulus operator.
1. User must first enter the value of the integer and store it in a variable.2. The value of the integer is then stored in another temporary variable.3. The while loop is used and the last digit of the number is obtained by using the modulus operator.4. The last digit is then stored at the one’s place, second last at the ten’s place and so on.
1. User must first enter the value of the integer and store it in a variable.2. The value of the integer is then stored in another temporary variable.3. The while loop is used and the last digit of the number is obtained by using the modulus operator.4. The last digit is then stored at the one’s place, second last at the ten’s place and so on.5. The last digit is then removed by truly dividing the number with 10.
1. User must first enter the value of the integer and store it in a variable.2. The value of the integer is then stored in another temporary variable.3. The while loop is used and the last digit of the number is obtained by using the modulus operator.4. The last digit is then stored at the one’s place, second last at the ten’s place and so on.5. The last digit is then removed by truly dividing the number with 10.6. This loop terminates when the value of the number is 0.
1. User must first enter the value of the integer and store it in a variable.2. The value of the integer is then stored in another temporary variable.3. The while loop is used and the last digit of the number is obtained by using the modulus operator.4. The last digit is then stored at the one’s place, second last at the ten’s place and so on.5. The last digit is then removed by truly dividing the number with 10.6. This loop terminates when the value of the number is 0.7. The reverse of the number is then compared with the integer value stored in the temporary variable.
1. User must first enter the value of the integer and store it in a variable.2. The value of the integer is then stored in another temporary variable.3. The while loop is used and the last digit of the number is obtained by using the modulus operator.4. The last digit is then stored at the one’s place, second last at the ten’s place and so on.5. The last digit is then removed by truly dividing the number with 10.6. This loop terminates when the value of the number is 0.7. The reverse of the number is then compared with the integer value stored in the temporary variable.8. If both are equal, the number is a palindrome.
1. User must first enter the value of the integer and store it in a variable.2. The value of the integer is then stored in another temporary variable.3. The while loop is used and the last digit of the number is obtained by using the modulus operator.4. The last digit is then stored at the one’s place, second last at the ten’s place and so on.5. The last digit is then removed by truly dividing the number with 10.6. This loop terminates when the value of the number is 0.7. The reverse of the number is then compared with the integer value stored in the temporary variable.8. If both are equal, the number is a palindrome.9. If both aren’t equal, the number isn’t a palindrome.
1. User must first enter the value of the integer and store it in a variable.2. The value of the integer is then stored in another temporary variable.3. The while loop is used and the last digit of the number is obtained by using the modulus operator.4. The last digit is then stored at the one’s place, second last at the ten’s place and so on.5. The last digit is then removed by truly dividing the number with 10.6. This loop terminates when the value of the number is 0.7. The reverse of the number is then compared with the integer value stored in the temporary variable.8. If both are equal, the number is a palindrome.9. If both aren’t equal, the number isn’t a palindrome.10. The final result is then printed.