The result of multiplying a float and a int is equal to float . In addition, when switching to printf it will be increased to double . You need the formats %a , %e , %f or %g . The %d format is used to print int types.
Editorial Note: The return value of main must be int . Here's a fixed program:
#include <stdio.h> int main(void) { float a = 3.3f; int b = 2; printf("%a\n", a * b); printf("%e\n", a * b); printf("%f\n", a * b); printf("%g\n", a * b); return 0; }
and its conclusion:
$ ./example 0x1.a66666p+2 6.600000e+00 6.600000 6.6
source share