Courses /
C# Basics
Type Casting Practice
Store the value number
in the variables n1
and n2
. Use explicit type casting if needed.
main.cs
1. Use type casting only on the
long
variable.
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);
}
}
}
Everything was clear?
Section 2. Chapter 12
Course Content
C# Basics
C# Basics
Type Casting Practice
Store the value number
in the variables n1
and n2
. Use explicit type casting if needed.
main.cs
1. Use type casting only on the
long
variable.
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);
}
}
}
Everything was clear?
Section 2. Chapter 12