Console.WriteLine("Input the length and breadth");
int a = 10;
Console.WriteLine("Lenght of the rectangle is" + " " + a );
Console.Writeline("Now enter the \"breadth\" of rectangle");
Console.ReadLine();
int b = int.Parse(Console.ReadLine());
int Perimeter = 4*(a*b);
int Area = a*b;
Console.WriteLine("The perimeter of rectangle is" + " "+ Perimeter);
Console.WriteLine("The area of rectangle is" + " " + Area);
First question :
In the above program if i comment out console.readline(); , then i am getting the output.
But, if i dont comment out console.readline();, then i am getting an exception error. Why?
second Question:
When the fourth line of code is executed i.e Console.Writeline("Now enter the \"breadth\" of rectangle"); i am getting a cursor mark to input the value from user. But the same cursor mark is not appearing where there are other console.writeline . Why?
Third question:
I have confusion when we use Console.readline(); What does this do?

Khaja MoizuddinRank #270 · 9.4K reputationPosted Jun 3, 2017, 7:05 AM EDT
Khaja MoizuddinRank #270 · 9.4K reputationPosted Jun 2, 2017, 10:28 PM EDT
Khaja MoizuddinRank #270 · 9.4K reputationPosted Jun 2, 2017, 10:32 PM EDT
harish reddy176 reputationPosted Jun 2, 2017, 11:34 PM EDT
Khaja MoizuddinRank #270 · 9.4K reputationPosted Jun 3, 2017, 1:23 AM EDT
harish reddy176 reputationPosted Jun 3, 2017, 5:17 AM EDT
Vivek KumarRank #272 · 9.3K reputationPosted Jun 3, 2017, 6:40 AM EDT