Умножене int и double | Sololearn: Learn to code for FREE!

+1

Умножене int и double

Решаю задачку, надо в уравнении 0.2*int(к примеру 13000). https://code.sololearn.com/cDkY7Dobaaz5/?ref=app

c#

4/27/2021 9:10:11 PM

TouchiHe

10 Answers

New Answer

+3

https://code.sololearn.com/cvDeB6iq6v58/?ref=app

+3

TouchiHe I'm not sure what the code was before applying the fix by Sayed🇧🇩🇧🇩 ... But I figured I would present an alternative of the code using various C# language features you may not have been aware of. https://code.sololearn.com/cpfBJj3MWNf5/?ref=app

+1

In the name of kindly generous ALLAH Thanks ALLAH in 17line you got a mathematuc phrase with a double(decimal number)so the whole reault calculated as double while your variable type is int !:you can not pass double to int but can int to double so use double type in everywhere from your code or in line 17 calculate the whole result as int such as Convert.toInt32(phrase);

+1

look https://www.sololearn.com/post/941100/?ref=app

+1

I tried to make all the code in double, nothing came of it, if in line 17 it is calculated to int, then the result will be incorrect, since it will replace 0.2 with 0

+1

TouchiHe I'm not sure if you're simply making a statement or if you're seeking a response from me to provide an explanation. If it's the former, then I'm assuming you're still learning many of the basics and I wish you luck on your continued growth. 😉👌 If it's the latter, it wasn't clear as nothing specific was requested. I'm happy to respond to any questions about specific parts you identify. But, you'll need to point out something specific for me to respond to. Otherwise, I'm not really sure where to begin with a general statement like: "I didn't understand most of the code at all."

0

Oh, thank you

0

To be honest, I didn't understand most of the code at all.

0

David Carroll

0

David Carroll it was a statement, but in general, if it's not difficult for you, could you describe everything that happens there in the comments to the code?