For the following C# code select the relevant solution for conversion of data type.
static void Main(string[] args)
{
int num1 = 20000;
int num2 = 50000;
long total;
total = num1 + num2;
Console.WriteLine("Total is : " +total);
Console.ReadLine();
}
static void Main(string[] args)
{
int num1 = 20000;
int num2 = 50000;
long total;
total = num1 + num2;
Console.WriteLine("Total is : " +total);
Console.ReadLine();
}A. Compiler will generate runtime error
B. Conversion is implicit type, no error generation
C. Specifying data type for conversion externally will solve the problem
D. None of the mentioned
Answer: Option B
Related Questions on Basic Syntax and Data Types in C Sharp
What is the correct syntax to declare a variable in C#?
A. num = int;
B. var num;
C. num int;
D. int num;
What is the purpose of the 'var' keyword in C#?
A. Declares a constant
B. Converts a variable to string
C. Implicitly declares a variable
D. Defines a method

Join The Discussion