Last active
August 19, 2020 08:12
-
-
Save jerome-pouiller/549793880c46f93960716ee01b4a4888 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
* Licence: GPL | |
* Created: 2020-08-18 17:36:11+02:00 | |
* Main authors: | |
* - Jérôme Pouiller <[email protected]> | |
*/ | |
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
int X = 10000; | |
int a = 300020; | |
int b = 200000; | |
int res0, res1, res2, res3, res4; | |
float res_float; | |
res_float = (float)X * (float)a / (float)b; | |
res0 = X * (a / b) + (a % b) * (X / b) + (a % b) * (X % b) / b; | |
res1 = (X * a) / b; | |
res2 = (X / b) * a; | |
res3 = X * (a / b); | |
if (b / a) | |
res4 = X / (b / a); | |
else | |
res4 = -1; | |
printf("%d %d %d %d %d %d\n", (int)res_float, res0, res1, res2, res3, res4); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment