Visual Programming-1
Visual Programming-1
Visual Programming:
Write() method displays the output but do not provide a new line character.
WriteLine() method displays the output and also provides a new line character it
the end of the string, This would set a new line for the next output.
Let us see an example to learn about the difference between Write() and
WriteLine() method −
Example
using System;
class Program {
Console.Write("One");
Console.Write("Two");
Console.WriteLine("Three");
Console.WriteLine("Four");
Console.WriteLine("Five");
}
Output
OneTwoThree
Four
Five
The C# readline method is mainly used to read the complete string until the user
presses the Enter key or a newline character is found.
Using this method, each line from the standard data input stream can be read. It is also
used to pause the console so that the user can take a look at the output.
The default data type of the C# readline is string. Some of the typecasting methods for
non-string input data types in order to convert them from string to the respective data
types are as given below-
Method - Convert.ToInt32();
Syntax - Convert.ToInt32(Console.ReadLine());
Method - Convert.ToDouble();
Syntax - Convert.ToDouble(Console.ReadLine());
boolean data type
Method - Convert.ToBoolean();
Syntax - Convert.ToBoolean(Console.ReadLine());
Method - Convert.ToChar();
Syntax - Convert.ToChar(Console.ReadLine());
using System;
class Program1 {
}
using System;
using System.IO; // defining the System package
class Program2 {
// declaring variables
int price;
string name;
int icecreams;
int total;