Check whether the number can be made palindromic after adding K | C # program to check whether the number can be made palindrome number after adding K ; Function to check whether a number is a palindrome or not ; Convert num to string ; Comparing kth character from the beginning and N - kth character from the end . If all the characters match , then the number is a palindrome ; If all the above conditions satisfy , it means that the number is a palindrome ; Driver code
using System ; class GFG { static void checkPalindrome ( int num ) { String str = num . ToString ( ) ; int l = 0 , r = str . Length - 1 ; while ( l < r ) { if ( str [ l ] != str [ r ] ) { Console . Write ( " No " ) ; return ; } l ++ ; r -- ; } Console . Write ( " Yes " ) ; return ; } public static void Main ( String [ ] args ) { int n = 19 , k = 3 ; checkPalindrome ( n + k ) ; } }