Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
Problem in Converting Decimal to Binaray
Smart Lucky
Jun 15 2011 2:53 AM
1.3k
Reply
Hi
i am trying to convert decimal to binary but problem is that it is not giving me proper result can any one help me.....?
program is below..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BinarayNumber
{
class Program
{
static void Main(string[] args)
{
Console.Write("Please Enter any number......");
int number = int.Parse(Console.ReadLine());
int reminder, value = 0;
string binaray = null;
for (int i = 0; i <= number; i++)
{
reminder = number % 2;
value = number / 2;
number = value;
Console.WriteLine("Reminder is {0} , Value is {1} , Number is now {2}", reminder, value, number);
reminder += value;
binaray += reminder;
}
Console.WriteLine("Binray value is is" + binaray);
Console.ReadKey();
}
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
anybody help me for creating login page in asp.net
Voice chat development in asp.net