I have written this program for the endian conversion but i am getting incorrect output. I am still unable to understand why?

[insert]Code:#include <stdio.h> #include <stdlib.h> int main(void) { unsigned int i = 1; unsigned int j = 1; unsigned int result; unsigned int temp1 = 255, temp2 = 255; int k =0; for(k = 0; k< 31; k++) { result = j&i; printf("%d", (result>0)? 1:0); i = i<<1; } i = 1; for(k = 0; k< 31; k++) { result = temp1&i; printf("%d", (result>0)? 1:0); i = i<<1; } i = 1; temp1 = temp1<<16; temp2 = temp2<<8; i = ((i>>24)| ((i<<8) & temp1) | ((i>>8) & temp2) | (i << 24)); printf("\n After endian conversion\n"); for(k = 0; k< 31; k++) { result = j&i; printf("%d", (result>0)? 1:0); i = i<<1; } return 0; }