I've been writing this program in C, and I've noticed that the division result, captured in the fee
variable, has always fixed value, and that is 5.00, but the result should be 5.78.
Can you explain why it has this behaviour and what should I do to fix it
?
#include <stdio.h>
#include <stdlib.h>
int main(void){
printf("Input package dimensions: width, heigth, length \n");
int width, height, length;
scanf("%d", &width );
scanf("%d", &height );
scanf("%d", &length );
int weight = width*height*length;
printf("%d\n", weight);
float fee = weight/166;
printf("%.2f\n", fee);
printf("The fee is : $%.2f\n and", fee);
system("pause");
return 0;
}