© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
59 replies
احمد

❔ ✅ denary -> binary

using System.Data;

static void Main(string[] args)
{
    string ans = AddBinary(1, 2);
    Console.WriteLine(ans);
    Console.ReadLine();
}
static string AddBinary(int a, int b)
{
    string string_combiner = "";
    int number = a + b;

    for (int i = 1; i <= 32; i++)
    {

        int powered_number = (int)Math.Pow(number, i);
        if (number % powered_number == 0)
        {
            string_combiner.Insert(0, "1");
        }


        else
        {
            string_combiner.Insert(0, "0");
        }

    }

    return string_combiner;

}
using System.Data;

static void Main(string[] args)
{
    string ans = AddBinary(1, 2);
    Console.WriteLine(ans);
    Console.ReadLine();
}
static string AddBinary(int a, int b)
{
    string string_combiner = "";
    int number = a + b;

    for (int i = 1; i <= 32; i++)
    {

        int powered_number = (int)Math.Pow(number, i);
        if (number % powered_number == 0)
        {
            string_combiner.Insert(0, "1");
        }


        else
        {
            string_combiner.Insert(0, "0");
        }

    }

    return string_combiner;

}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

BinaryReader and BinaryWriter api behaviour incompatibility
C#CC# / help
4y ago
✅ Binary Search
C#CC# / help
2y ago
✅ Binary Formatter
C#CC# / help
4y ago
Process Binary String
C#CC# / help
7mo ago