TCS Coding Practice Question | Palindrome String
Given a string, the task is to check if this String is Palindrome or not using Command Line Arguments.
Input: str = "Geeks" Output: No Input: str = "GFG" Output: Yes
- Since the string is entered as Command line Argument, there is no need for a dedicated input line
- Extract the input string from the command line argument
- Traverse through this String character by character using loop, till half the length of the sting
- Check if the characters from one end match with the characters from the other end
- If any character do not matches, the String is not Palindrome
- If all character matches, the String is a Palindrome
Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.