V can convert ny Binary Number in2 its Gray Code @ nytime.V dn't need 2 start 4m 0. Da algo is: Binary to Gray Code Start 4m MSB (Left side of the Number) g(MSB)=b(MSB) g(ith bit)=b(ith bit) XOR b(i+1 th bit) As an Example: Binary= 1 0 0 0 1 1 0 |\|\|\|\|\|\| Gray = 1 1 0 0 1 0 1 Gray Code to Binary Start from MSB b(MSB)=g(MSB) b(ith bit)=g(ith bit) if the number of 1's preceding g(ith bit) is Even else b(ith bit)=NOT of g(ith bit) As an Example: Gray 1 1 0 0 1 0 1 Binary 1 0 0 0 1 1 0 Comments MSB Prec 1 is odd Prec 1 is Even Prec 1 is Even Prec 1 is Even Prec 1 is odd Prec 1 is Odd Here is a Conversion Program:: // Header Files Inclusion #include<stdio.h> #include<conio.h> #include<string.h> // User defined Functions Prototype List void printcenter(char *s,int c); // Function to print text in Center of Screen void printtabbed(char *s,int t,int c); // Function to print text with preceding space from the
আমার হিজিবিজি খাতা