Last active
March 2, 2024 21:28
-
-
Save nyg/4c29ba0da5655029754a4e3d3e6fb21c to your computer and use it in GitHub Desktop.
Euclidean division in C.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(int argc, const char** argv) { | |
unsigned int a = 0xDEADBEEF; | |
unsigned int b = 0xBABE; | |
unsigned int q = a / b; | |
unsigned int r = a % b; | |
printf("%u = %u * %u + %u\n", a, q, b, r); | |
printf("%X = %X * %X + %X\n", a, q, b, r); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment