Find the Number which contain the digit d | C # program to print the number which contain the digit d from 0 to n ; function to display the values ; Converting d to character ; Loop to check each digit one by one . ; initialize the string ; checking for digit ; Driver code
using System ; class GFG { static void printNumbers ( int n , int d ) { String st = " " + d ; char ch = st [ 0 ] ; for ( int i = 0 ; i < n ; i ++ ) { st = " " ; st = st + i ; if ( i == d || st . IndexOf ( ch ) >= 0 ) Console . Write ( i + " ▁ " ) ; } } public static void Main ( ) { int n = 100 , d = 5 ; printNumbers ( n , d ) ; } }