+ 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
30th Mar 2021, 4:31 PM
A͢J
A͢J - avatar
+ 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".
30th Mar 2021, 5:37 PM
A͢J
A͢J - avatar
+ 2
Shahid Zia Do not spam.
1st Apr 2021, 12:08 PM
A͢J
A͢J - avatar
+ 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.
30th Mar 2021, 5:04 PM
Ipang
+ 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.
31st Mar 2021, 4:39 PM
A͢J
A͢J - avatar
+ 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.
31st Mar 2021, 4:45 PM
A͢J
A͢J - avatar
+ 1
Lockie Yes but I got error because you have used %%d instead of %% %d.
31st Mar 2021, 4:49 PM
A͢J
A͢J - avatar
+ 1
Lockie I am not sure but I got that error so I did cast with int.
31st Mar 2021, 5:04 PM
A͢J
A͢J - avatar
- 2
Write codes perfectly
31st Mar 2021, 11:02 PM
blocked