+ 3

®[Challenge ] what is output ?

double x; int y; x = 44 .566; y = (int) (x); Console.WriteLine(y);

3rd Feb 2018, 9:25 AM
Hossam Hassan
Hossam Hassan - avatar
4 odpowiedzi
+ 5
44
3rd Feb 2018, 9:34 AM
Strange
Strange - avatar
+ 5
what y = (int) (x) does is to cast x known as data casting, it forces x to be an integer which causes it to be terminated to the integer part. P. S : I don't code in C# but there's something similar in Java and I think it works same way
3rd Feb 2018, 9:36 AM
Strange
Strange - avatar
+ 3
true
3rd Feb 2018, 9:52 AM
Hossam Hassan
Hossam Hassan - avatar
+ 1
44
4th Feb 2018, 8:16 AM
Pavlin