The following practical example is for Question number 1d as per the syllabus of asp.net of Mumbai university.
Explanation.
The following program takes 2 integer variable as an input from the user using Console.ReadLine() method. This method allows you to take user input. You need to remember that type of input you take , the same type you need to convert the Console.ReadLine() method. Over here we are taking one string and one integer variable for the imput
Flow of the Program
- First we declare the variable with datatypes int and string.
- Then we prompt the user to enter the integer variable and string value using the Console.ReadLine() method.
- If you see for integer input we have converted the Console.ReadLine() method as implicit conversion cannot be achieved over here.
- For string input we do not need to convert as Console.ReadLine() by default accepts string value.
- After taking the input we are printing the value of Integer and string using Console.WriteLine() Method.