Convert int to double | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Convert int to double

I’m trying to convert an integer into a double. I tried Convert.ToDouble (t) t = Y Y is a number that might be a decimal depending on what the user inputs https://code.sololearn.com/c8tz4t5lr9qu/?ref=app

25th Jun 2018, 3:17 PM
Ryan Wu
1 Answer
+ 2
Convert.ToDouble doesn‘t change the data type of the variable t, it instead returns the content of that variable cast to a double. hence you can‘t assign the variable Y of type double to the variable t of type int
25th Jun 2018, 3:26 PM
Max
Max - avatar