Vidyalelo
C# Programming · Q57

File Handling and Input Output in C Sharp

Programming · C# Programming · question 57

Q57

What will be the output of the following C# code? static void Main(string[] args) Console.WriteLine("This is a Console Application:"); Console.Write("Please enter your lucky number:"); string val1 = Console.ReadLine(); int val2 = System.Convert.ToInt32(val1, 10); val2 = val2 * val2; Console.WriteLine("square of number is:" +val2); Console.Read();

A.
Compile time error
B.
Runs successfully does not print anything
C.
Runs successfully, ask for input and hence displays the result
Answer
D.
Syntax Error

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board