What I want to know is why?
Code compiled but not with a well enabled compiler.
Save time, enable all warnings - it is more productive than posting on SO.
long long product1 = userNum1 * userNum2 * userNum3 * userNum4;
...
printf("%0.3lf %0.3lf
", product1, avg1);
warning: format '%lf' expects argument of type 'double', but argument 2 has type 'long long int' [-Wformat=]
Use matching print specifiers like "%g"
with double
and "%lld"
with long long
.
Also was it valid for me to cast type double
when variables are double
already.
Yes, but unnecessary.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…