#include <stdio.h> #include <stdint.h> uint32_t convert_endian(uint32_t value) { // Write logic to swap bytes uint32_t ret_val=0; ret_val |= (value&0x000000FF)<<24; ret_val |= (value&0x0000FF00)<<8; ret_val |= (value&0x00FF0000)>>8; ret_val |= (value&0xFF000000)>>24; return ret_val; } int main() { uint32_t val; scanf("%u", &val); printf("%u", convert_endian(val)); return 0; }
Test Cases
Test Results
Input
305419896
Expected Output
2018915346