How to convert char array into a single int in C#

1 Answer

0 votes
using System;

public class Program
{
	public static void Main(string[] args)
	{
		char[] arr = new char[] {'4', '7', '0', '9'};

		int n = int.Parse(new string(arr));

		Console.WriteLine(n);
	}
}





/*
run:

4709

*/

 



answered Sep 23, 2022 by avibootz

Related questions

1 answer 158 views
1 answer 182 views
1 answer 165 views
1 answer 168 views
...