Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Práctica de Conversión de Tipos | Manejo de Tipos de Datos
Quizzes & Challenges
Quizzes
Challenges
/
Fundamentos de C#

bookPráctica de Conversión de Tipos

Store the value number in the variables n1 and n2. Use explicit type casting if needed.

main.cs

main.cs

copy
1234567891011121314151617181920
using 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

main.cs

copy
1234567891011121314151617181920
using 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); } } }

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 12

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

Suggested prompts:

What data type is the variable `number`?

Can you show an example of how to use type casting on the `long` variable?

Should I assume any initial value for `number`?

bookPráctica de Conversión de Tipos

Desliza para mostrar el menú

Store the value number in the variables n1 and n2. Use explicit type casting if needed.

main.cs

main.cs

copy
1234567891011121314151617181920
using 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

main.cs

copy
1234567891011121314151617181920
using 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); } } }

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 12
some-alt