Check if mirror image of a number is same if displayed in seven segment display | C # Program to check if mirror image of a number is same if displayed in seven segment display ; Return " Yes " , if the mirror image of number is same as the given number Else return " No " ; Checking if the number contain only 0 , 1 , 8. ; Checking if the number is palindrome or not . ; If corresponding index is not equal . ; Driver Code
using System ; class GFG { static string checkEqual ( string S ) { for ( int i = 0 ; i < S . Length ; i ++ ) { if ( S [ i ] != '1' && S [ i ] != '0' && S [ i ] != '8' ) { return " No " ; } } int start = 0 , end = S . Length - 1 ; while ( start < end ) { if ( S [ start ] != S [ end ] ) { return " No " ; } start ++ ; end -- ; } return " Yes " ; } public static void Main ( ) { string S = "101" ; Console . WriteLine ( checkEqual ( S ) ) ; } }