Calculators | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

Calculators

Why is my percent for both of these calculators not working? It comes out as an error https://code.sololearn.com/c4b65tZo8xaw/?ref=app https://code.sololearn.com/cfWplXbSjdiu/?ref=app

12th Mar 2022, 10:16 PM
Junior
Junior - avatar
14 Answers
13th Mar 2022, 6:02 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
12th Mar 2022, 10:42 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
Your Mom , modulo operation can be applied only for integers.
12th Mar 2022, 10:21 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
You can't use the modulo with a floating point number.
12th Mar 2022, 10:22 PM
rodwynnejones
rodwynnejones - avatar
+ 1
Your Mom , yes cast it to integer =>(int) a %(int) b;
12th Mar 2022, 10:28 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
12th Mar 2022, 10:34 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
use "fmod()" from the math.h / cmath header file .
12th Mar 2022, 10:40 PM
rodwynnejones
rodwynnejones - avatar
0
Okay, but why is it still now working?
12th Mar 2022, 10:20 PM
Junior
Junior - avatar
0
So is there any easy way to fix this?
12th Mar 2022, 10:26 PM
Junior
Junior - avatar
0
Ye but i think ihave to get user input for that FF9900
12th Mar 2022, 10:31 PM
Junior
Junior - avatar
0
13th Mar 2022, 5:36 PM
Junior
Junior - avatar
0
So Parse is to convert a type ‘string’ into an ‘int’?
13th Mar 2022, 8:41 PM
Junior
Junior - avatar
- 1
Can you show me what u mean TheWh¡teCat 🇧🇬 ?
12th Mar 2022, 10:32 PM
Junior
Junior - avatar
- 1
And the C code? TheWh¡teCat 🇧🇬
12th Mar 2022, 10:38 PM
Junior
Junior - avatar