Program to implement ASCII lookup table | C # implementation for ASCII table lookup ; Function to convert decimal value to equivalent octal value ; Function to convert decimal value to equivalent hexadecimal value ; Function to convert decimal value to equivalent HTML value ; ASCII lookup table ; Implicit typecasting converts the character into it 's equivalent ASCII ; Driver Code
using System ; class GeeksforGeeks { static int Octal ( int decima ) { int octal = 0 ; String temp = " " ; while ( decima > 0 ) { int remainder = decima % 8 ; temp = remainder + temp ; decima /= 8 ; } for ( int i = 0 ; i < temp . Length ; i ++ ) octal = ( octal * 10 ) + ( temp [ i ] - '0' ) ; return octal ; } static String Hexadecimal ( int decima ) { String hex = " " ; while ( decima > 0 ) { int remainder = decima % 16 ; if ( remainder >= 0 && remainder <= 9 ) hex = remainder + hex ; else hex = ( char ) ( ' A ' + remainder % 10 ) + hex ; decima /= 16 ; } return hex ; } static String HTML ( int decima ) { String html = " " ; html = html + decima ; html = " & # " + html + " ; " ; return html ; } static void ASCIIlookuptable ( char ch ) { int decima = ch ; Console . WriteLine ( " Octal ▁ value : ▁ " + Octal ( decima ) ) ; Console . WriteLine ( " Decimal ▁ value : ▁ " + decima ) ; Console . WriteLine ( " Hexadecimal ▁ value : ▁ " + Hexadecimal ( decima ) ) ; Console . Write ( " HTML ▁ value : ▁ " + HTML ( decima ) ) ; } public static void Main ( ) { char ch = ' @ ' ; ASCIIlookuptable ( ch ) ; } }