There must be some egregious mistake I'm guilty of but I'm calculating the result of 2880 * 12 / 512 in C and even though I'm saving the result in a double
variable it just doesn't save the remainder. According to Google and any other calculator 2880 * 12 / 512 = 67.5 however according to the program below it's 67.00. This is the code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <math.h>
int main() {
double result;
result = 2880 * 12 / 512;
printf("result = %f\n", result);
return 0;
}
I'm compiling the file called test.c which contains the code as: gcc test.c -o test -lm
.
What am I doing wrong?