/*
Convert decimal number to Grey code and back again
*/
# include<stdio.h>
#define SIZE 32
int bits[SIZE], i; // could be chars in 8 bit machine
unsigned long num; // could be int if less than 17 bit Grey code
void main(){
printf("\n ");
printf("%d",SIZE);
printf(" bit number conversion\n");
printf("\n Enter number ");
scanf("%lu",&num);
/* converting number to binary equivalent */
/* MSB is 1st element in array */
for(i = 0; i < SIZE; i ++){
bits[SIZE-1-i] = (num >> i) & 1;
}
/* printing binary */
printf(" Binary ");
for(i = 0; i < SIZE; i ++){
printf("%d",bits[i]);
}
/* in-line gray code conversion */
for(i = SIZE-1; i > 0; i --){
bits[i] = bits[i] ^ bits[i - 1];
}
/* printing gray code */
printf("\n Gray code ");
for(i = 0; i < SIZE; i ++){
printf("%d",bits[i]);
}
/* in-line conversion back to binary */
for(i = 1; i < SIZE; i++){
bits[i] = bits[i] ^ bits[i - 1];
}
/* reprinting binary */
printf("\n Restored binary ");
for(i=0;i<SIZE;i++){
printf("%d",bits[i]);
}
/* convert back to decimal */
num = 0;
for (i = 0; i < SIZE; i ++){
num = (num<<1) | bits[i];
}
/* reprinting decimal number */
printf("\n Restored decimal ");
printf("%lu",num);
printf("\n");
}

Hi everyone!, I had this confusion about the the Bucket Sort Algorithm.
I just wanna know why mostly bucket sort use the range of element in between 0 and 1 ...

Good day community,
I have completed vb.net program (a school timetabling program) and I am in the process to create a website. At the moment word -press on wamp server ...