#include <stdio.h> #include <stdint.h> uint32_t convert_endian(uint32_t value) { // Write logic to swap bytes uint8_t byte1 = value & 0xFF; uint8_t byte2 = (value >> 8) & 0xFF; uint8_t byte3 = (value >> 16) & 0xFF; uint8_t byte4 = (value >> 24) & 0xFF; uint32_t res = (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4; return res; } int main() { uint32_t val; scanf("%u", &val); printf("%u", convert_endian(val)); return 0; }
Test Cases
Test Results
Input
305419896
Expected Output
2018915346