Práctica de Conversión de Tipos
Almacena el valor number
en las variables n1
y n2
. Usa conversión de tipo explícita si es necesario.
main.cs
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
}
}
}
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); } } }
Usa la conversión de tipo solo en la variable
long
.
main.cs
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
}
}
}
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); } } }
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 12
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla