+ 6
Lockie
You have used %% in last print statement.
Problem is here also. div should be float not integer because division may return float valve
div = (a * b) / (mul * mul);
https://code.sololearn.com/cwB68IzLXnB3/?ref=app
+ 6
Martin Taylor
Well said last statement but people just focus on "Any fool can write code that a computer can understand" but not on this statement "Good Programmers write code that humans can understand".
+ 2
Shahid Zia
Do not spam.
+ 1
Possible result of zero from integer division at line 17, causing hard crash due to the use of zero as RHS for a modulo operation at line 19.
Use of `float` type for <div> wouldn't help here either, cause modulo operator doesn't accept floating point value as either of its operands.
+ 1
Lockie
Okay got you. You wanted % to show modulus operator. But I don't think it would be valid because C will consider as %d.
+ 1
Lockie
I said float because when I ran your code I got FloatingPoint core dump error. This error maybe because when we divide integer with integer then result maybe in float. That's why I cast with Integer to avoid that error.
+ 1
Lockie
Yes but I got error because you have used %%d instead of %% %d.
+ 1
Lockie
I am not sure but I got that error so I did cast with int.
- 2
Write codes perfectly



