C# Program to Convert a Binary String to an Integer Last Updated : 02 Jul, 2020 Comments Improve Suggest changes Like Article Like Report Given an binary string as input, we need to write a program to convert the binary string into equivalent integer. To convert an binary string to integer, we have to use Convert.ToInt32(String, Base/Int32) function to convert the values. The base of the binary is 2. Syntax: Convert.ToInt32(String, Base/Int32); Examples: Input : 1010101010101010 Output : 43690 Input : 1100011000 111100001111 11001100110011001100 Output : 792 3855 838860 Program 1: csharp // C# program to convert array // of binary string to an integer using System; using System.Text; class GFG { static void Main(string[] args) { // binary number as string string bin_strng = "1010101010101010"; int number = 0; // converting to integer number = Convert.ToInt32(bin_strng, 2); // to print the value Console.WriteLine("Number value of binary \"{0}\" is = {1}", bin_strng, number); } } Output: Number value of binary "1010101010101010" is = 43690 Program 2: C# // C# program to convert array // of binary string to an integer using System; using System.Text; namespace geeks { class GFG { static void Main(string[] args) { // binary number as string string bin_strng = "1100011000"; int number = 0; // converting to integer number = Convert.ToInt32(bin_strng, 2); // to print the value Console.WriteLine("Number value of binary \"{0}\" is = {1}", bin_strng, number); bin_strng = "111100001111"; // converting to integer number = Convert.ToInt32(bin_strng, 2); // to print the value Console.WriteLine("Number value of binary \"{0}\" is = {1}", bin_strng, number); bin_strng = "11001100110011001100"; // converting to integer number = Convert.ToInt32(bin_strng, 2); // to print the value Console.WriteLine("Number value of binary \"{0}\" is = {1}", bin_strng, number); // hit ENTER to exit Console.ReadLine(); } } } Output: Number value of binary "1100011000" is = 792 Number value of binary "111100001111" is = 3855 Number value of binary "11001100110011001100" is = 838860 Comment More infoAdvertise with us Next Article C# Program to Convert a Binary String to an Integer S shivanisinghss2110 Follow Improve Article Tags : C# C# Programs Similar Reads C# Program to Find Binary Equivalent of an Integer using Recursion Given an integer number, now we convert the given integer number into a binary number using recursion. Recursion is a method in which a function calls itself directly or indirectly and such type of function is known as a recursive function. It solves the problem very efficiently like we find the bin 3 min read Convert Decimal to Binary in C In this article, we will learn to write a C program to convert a decimal number into a binary number. The decimal number system uses ten digits from 0 to 9 to represent numbers and the binary number system is a base-2 number system that uses only 0 and 1 to represent numbers. Algorithm to Convert De 2 min read Convert Binary to Decimal in C In this article, we will learn how to write a C program to convert the given binary number into an equivalent decimal number. Binary numbers are expressed in base 2 ( 0, 1 ) and decimal numbers are expressed in base 10 ( 0-9 ).Algorithm to Convert Binary Numbers to DecimalThe idea is to extract the 3 min read C Program For Char to Int Conversion Write a C program to convert the given numeric character to integer.Example:Input: '3'Output: 3Explanation: The character '3' is converted to the integer 3.Input: '9'Output: 9Explanation: The character '9' is converted to the integer 9.Different Methods to Convert the char to int in CThere are 3 mai 3 min read Number System Conversion in C Number system conversion is a fundamental concept in computer science and programming. It involves changing the representation of a number from one base to another, such as converting a decimal number to binary or a hexadecimal number to binary.In this article, we will create a console program in th 8 min read Binary representation of a given number Given an integer n, the task is to print the binary representation of the number. Note: The given number will be maximum of 32 bits, so append 0's to the left if the result string is smaller than 30 length.Examples: Input: n = 2Output: 00000000000000000000000000000010Input: n = 0Output: 000000000000 6 min read C++ Program For Binary To Decimal Conversion The binary number system uses only two digits 0 and 1 to represent an integer and the Decimal number system uses ten digits 0 to 9 to represent a number. In this article, we will discuss the program for Binary to Decimal conversion in C++. Algorithm to Convert Binary Numbers to DecimalInitialize a v 4 min read How to Convert an Integer to a String in C? In C, integers can be represented as strings with each digit represented by corresponding numeric character. In this article, we will learn how to convert integers into the stringExamplesInput: 1234Output: "1234"Explanation: The integer 1234 is converted to the string "1234".Input: -567Output: "-567 3 min read Program to convert given Binary to its equivalent ASCII character string Given a binary string str, the task is to find its equivalent ASCII (American Standard Code for Information Interchange) character string. Examples: Input: str = "0110000101100010"Output: abExplanation: Dividing str into set of 8 bits as follows: 01100001 = 97, ASCII value of 97 is 'a'.01100010 = 98 9 min read Lex program for Decimal to Binary Conversion Problem: Write a Lex program for Decimal to Binary conversion. Explanation: FLEX (Fast Lexical Analyzer Generator) is a tool/computer program for generating lexical analyzers (scanners or lexers) written by Vern Paxson in C around 1987. Lex reads an input stream specifying the lexical analyzer and o 1 min read Like