using System;
using System.Collections.Generic;
using System.Text;
namespace Demo {
class toBinary {
static void Main(string[] args) {
int val = 1010, myBinary, remainder;
int myDecimal = 0, baseVal = 1;
myBinary = val;
while (val > 0) {
remainder = val % 10;
myDecimal = myDecimal + remainder * baseVal;
val = val / 10;
baseVal = baseVal * 2;
}
Console.Write(Binary Number : + myBinary);
Console.Write(\nConverted to Decimal: + myDecimal);
Console.ReadLine();
}
}
}