Please help I want c# to come up with this once it comes up
Please enter a 7-bit binary number:
0010011
Your number with a parity bit is:
00100111
This is my code that I have come up with, its probably wrong please can you correct it so it is alright?
{
Console.WriteLine("Please enter a 7- bit binary number");
string number = Console.ReadLine();
int count1 = 0;
int count2 = 0;
for(int i = 0; i < number.Length; i++)
{
count1++;
}
else
{
count2++;
}
if (count1 < count2)
Console.WriteLine("Your number with parity bit is "+ number+ "1");
}
else
{
Console.WriteLine("Your number with parity bit is "+ number + "0");
}
}
}
}
Thx in advance for the help