How to convert character from string to ascii value in C#

1 Answer

0 votes
using System;
 
class Program
{
    static void Main() {
        string s = "c# programming";
         
        int n1 = s[3];
        Console.WriteLine(n1);
         
        int n2 = (int)s[3];
        Console.WriteLine(n2);
         
    }
}
 
 
 
/*
run:
 
112
112
 
*/

 



answered Nov 28, 2019 by avibootz

Related questions

1 answer 109 views
1 answer 121 views
121 views asked May 7, 2022 by avibootz
1 answer 183 views
183 views asked Nov 28, 2019 by avibootz
1 answer 159 views
159 views asked Nov 28, 2019 by avibootz
1 answer 196 views
1 answer 212 views
...