after looking for all answers I still coudnt find solution for my code.
Variables needs to be type INT, but in one case I need to print decimal solution. I have tried with casting, still didint work.
int sum = 6;
int product = 24;
int differenz, result, division, rest, decimal;
differenz = ++product - sum++;
result = differenz * sum;
division = result / 9;
rest = result % 9;
decimal = result / 9.0;
printf("Result = %d\n", result);
printf("Integer division = %d\n", division);
printf("Remainder = %d\n", rest);
printf("Division = %.2f\n", (float) decimal);
float b = (float) decimal;
printf("Division = %.2f\n", b);
This is because you created the variable decimal as an int and you're trying to print it as a float.
Either create the variable as a float, or print it as an int, but you cannot mix both.
Also, casting an int to a float will just add the ".00", you won't be able to modify that.