8086 program to check whether a string is palindrome or not
Problem: Write an 8086 program to check whether a given string is palindrome or not.
Input String: "abba" Output: String is palindrome Input String: "abbca" Output: String is not palindrome
- Create a string
- Traverse to the end of the string
- Get the address of the end of the string, DI
- Load the starting address of the string, SI
- Compare the value stored at the address
- Increment the pointer, SI
- Decrements the pointer, DI
- Compare again the value stored at si and di
- Repeat the steps until SI<=DI
- If all the characters match print string is palindrome else print not palindrome
String is palindrome
The program cannot be run on an online editor, please use MASM to run the program and use dos box to run MASM, you might use any 8086 emulator to run the program.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.