Floating c;
Scanf("%d%d ",&i, & b);
c =(float)a/b;
printf("c=%f\n ",c);
When your program is calculating a/b, because both A and B are integers, the computer will calculate them as integers, and the result is also integers. Then it is impossible to save decimals by assigning values to the integer variable C.
Float can be used to store floating-point numbers, but in the operation, A or B in a/b should be changed into floating-point numbers and then calculated, so that the computer can avoid using integers and write C = A/B; When calculating a/b, it will still be calculated as an integer, and the result will be rounded before being stored in C, so the program should be written as C = (float) A/B; Or c = a/(float) b; Or: c = a;; c/= b;
Or directly define a or b as floating-point variables and write c = a/b; There will be no problem.