Type Casting Practice
Store the value number
in the variables n1
and n2
. Use explicit type casting if needed.
main.cs
1234567891011121314151617181920using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { float number = 14.47f; // Change code below this line long n1 = ___; double n2 = ___; // Change code above this line Console.WriteLine(n1); Console.WriteLine(n2); } } }
Use type casting only on the long
variable.
main.cs
1234567891011121314151617181920using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { float number = 14.47f; // Change code below this line long n1 = (long) number; double n2 = number; // Change code above this line Console.WriteLine(n1); Console.WriteLine(n2); } } }
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 2. Hoofdstuk 12
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Suggested prompts:
What is the value of `number` that should be stored?
Can you show an example of how to use explicit type casting for the `long` variable?
Should `n1` and `n2` be of different data types?
Awesome!
Completion rate improved to 1.59
Type Casting Practice
Veeg om het menu te tonen
Store the value number
in the variables n1
and n2
. Use explicit type casting if needed.
main.cs
1234567891011121314151617181920using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { float number = 14.47f; // Change code below this line long n1 = ___; double n2 = ___; // Change code above this line Console.WriteLine(n1); Console.WriteLine(n2); } } }
Use type casting only on the long
variable.
main.cs
1234567891011121314151617181920using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { float number = 14.47f; // Change code below this line long n1 = (long) number; double n2 = number; // Change code above this line Console.WriteLine(n1); Console.WriteLine(n2); } } }
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 2. Hoofdstuk 12