Binary to Decimal Conversion in C#
###### Posted by Samath
Last Updated: January 10, 2021

Write a C# program that ask the user for a binary number and convert the number entered into decimal. a binary number is a number expressed in the base-2 numeral system, which uses only two symbols: 0 and 1.

```using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BinarytoDecimalConversion
{
public partial class frmBinarytoDecimalConversion : Form
{
public frmBinarytoDecimalConversion()
{
InitializeComponent();
}

private void btnconvert_Click(object sender, EventArgs e)
{

int bin_Num = int.Parse(txtinput.Text);
int dec_Num = 0;

int ba = 1;

while (bin_Num > 0)
{
int rem_Value = bin_Num % 10;
bin_Num = bin_Num / 10;
dec_Num += rem_Value * ba;
ba = ba * 2;
}

txtoutput.Text = dec_Num.ToString();

}
}
}
```
###### Decimal to Binary in C++
Samath | Dec 26, 2014
###### Python Convert Decimal to Binary or Binary to Decimal
Samath | Jan 09, 2017
###### Python to Convert Decimal to Binary, Octal and Hexadecimal
gideonna | Apr 13, 2016
###### SQL Display two digits after decimal point
SceDev | Feb 08, 2024
###### Java unit conversion program that convert (fl. oz, gal, oz, lb, in, ft, mi) to (ml, l, g, kg, mm, cm, m, km)
Samath | May 08, 2021
###### Binary Search Tree in C++
Samath | Jan 07, 2021
###### How to add and retrieve record in a binary file using C++
Samath | Jan 06, 2021
###### Convert Roman numerals to decimal using Java
Samath | Jan 17, 2024
###### C program that takes as input a positive fractional number and converts it to binary
Samath | Jan 01, 2017
###### C program that takes a non- negative integer number as input and prints its binary representation
Samath | Jan 01, 2017
###### C program that takes a 2 digit hexadecimal number and display it in binary format
Samath | Jan 01, 2017
###### Converting Time To Decimal using C++
Samath | Jan 04, 2017
###### C++ Convert from Decimal to Octal
Samath | Jan 05, 2017
###### C++ program that prompts the user to input a decimal number and outputs the number rounded to the nearest integer
Samath | Apr 06, 2022