Page 1 of 1

Q2-2) Answer the following two questions for the code given below: public class Square { public static void Main() { int

Posted: Mon May 30, 2022 4:05 pm
by answerhappygod
Q2 2 Answer The Following Two Questions For The Code Given Below Public Class Square Public Static Void Main Int 1
Q2 2 Answer The Following Two Questions For The Code Given Below Public Class Square Public Static Void Main Int 1 (22.67 KiB) Viewed 16 times
Q2-2) Answer the following two questions for the code given below: public class Square { public static void Main() { int num; string inputString: Console.WriteLine("Enter an integer"); inputString = Console.ReadLine(); num= Convert.Tolnt32(inputString); SquareVal(num); } public static void SquareVal(int x) ( int temp = x * x; Console.WriteLine("The squared of (0) is {1}", x, temp); } } a) Explain the code b) What is the output of the code if the user enters 4?