Articles on Trending Technologies

Technical articles with clear explanations and examples

Console.ReadLine() Method in C#

AmitDiwan
AmitDiwan
Updated on 14-Nov-2019 1K+ Views

The Console.ReadLine() method in C# is used to read the next line of characters from the standard input stream.SyntaxThe syntax is as follows −public static string ReadLine ();ExampleLet us now see an example to implement the Console.ReadLine() method in C# −using System; public class Demo{    public static void Main(){       string str;       Console.WriteLine("Enter any subject...");       str = Console.ReadLine();       Console.WriteLine("Entered subject = "+str);    } }OutputThis will produce the following output −Enter any subject... Entered subject = Maths

Read More

Console.Read() Method in C#

AmitDiwan
AmitDiwan
Updated on 14-Nov-2019 1K+ Views

The Console.Read() method in C# is used to read the next character from the standard input stream.SyntaxThe syntax is as follows −public static int Read ();ExampleLet us now see an example to implement the Console.Read() method in C# −using System; public class Demo{    public static void Main(){       int val;       Console.WriteLine("Enter a value");       val = Console.Read();       Console.WriteLine("Entered value: "+val);    } }OutputThis will produce the following output. Let’s sayEnter a value Entered value: 53

Read More

Console.MoveBufferArea() Method in C#

AmitDiwan
AmitDiwan
Updated on 14-Nov-2019 353 Views

The Console.MoveBufferArea() method in C# is used to copy a specified source area of the screen buffer to a specified destination area.SyntaxThe syntax is as follows −public static void MoveBufferArea (int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop);Here, sourceLeft             The leftmost column of the source area.sourceTop             The topmost row of the source area.sourceWidth             The number of columns in the source area.sourceHeight            The number of rows in the source area.targetLeft            The leftmost ...

Read More

Console.KeyAvailable() Property in C#

AmitDiwan
AmitDiwan
Updated on 14-Nov-2019 526 Views

The Console.KeyAvailable() property in C# is used to get a value indicating whether a key press is available in the input stream.SyntaxThe syntax is as follows −public static bool KeyAvailable { get; }ExampleLet us now see an example to implement the Console.KeyAvailable() property in C# −using System; using System.Threading; class Demo {    public static void Main (string[] args) {       ConsoleKeyInfo cs = new ConsoleKeyInfo();       do {          Console.WriteLine("Press a key to display; "+ "press the 'Q' key to quit.");          while (Console.KeyAvailable == false)Thread.Sleep(100);       ...

Read More

Console Class in C#

AmitDiwan
AmitDiwan
Updated on 14-Nov-2019 2K+ Views

The Console class in C# is used to represent the standard input, output, and error streams for console applications.Let us see some examples of Console class properties in C# −Console.CursorLeft propertyTo change the CursorLeft of the Console in C#, use the Console.CursorLeft property.ExampleLet us see an example −using System; class Demo {    public static void Main (string[] args) {       Console.BackgroundColor = ConsoleColor.Blue;       Console.WriteLine("Background color changed = "+Console.BackgroundColor);       Console.ForegroundColor = ConsoleColor.Yellow;       Console.WriteLine("Foreground color changed = "+Console.ForegroundColor);       Console.CursorLeft = 30;       Console.Write("CursorLeft position: "+Console.CursorLeft); ...

Read More

Decimal Struct in C#

AmitDiwan
AmitDiwan
Updated on 14-Nov-2019 476 Views

The Decimal Struct in C# Represents a decimal floating-point number. The Decimal value type represents decimal numbers ranging from positive 79, 228, 162, 514, 264, 337, 593, 543, 950, 335 to negative 79, 228, 162, 514, 264, 337, 593, 543, 950, 335. The default value of a Decimal is 0.Let us now see some examples of the methods in Decimal Struct −Decimal.Add()The Decimal.Add() method in C# is used to add two specified Decimal values.SyntaxFollowing is the syntax −public static decimal Add (decimal val1, decimal val2);Above, va1 is the first decimal to add, whereas val2 is the second decimal to be ...

Read More

UInt64 Struct in C#

AmitDiwan
AmitDiwan
Updated on 14-Nov-2019 473 Views

The UInt64 struct represents a 64-bit unsigned integer. The UInt64 value type represents unsigned integers with values ranging from 0 to 18, 446, 744, 073, 709, 551, 615.Let us now see some examples of UInt64 Struct methods −UInt64.CompareTo()The UInt64.CompareTo() method in C# is used to compare the current instance to a specified object or UInt64 and returns an indication of their relative values.SyntaxFollowing is the syntax −public int CompareTo (object val); public int CompareTo (ulong val;Above, the value for the 1st syntax is an object to compare. The value for 2nd syntax is an unsigned integer to compare.The return value ...

Read More

Uri.IsWellFormedOriginalString() Method in C#

AmitDiwan
AmitDiwan
Updated on 14-Nov-2019 118 Views

The Uri.IsWellFormedOriginalString() method in C# indicates whether the string used to construct this Uri was well-formed and is not required to be further escaped.SyntaxFollowing is the syntax −public bool IsWellFormedOriginalString ();ExampleLet us now see an example to implement the Uri.IsWellFormedOriginalString() method −using System; public class Demo {    public static void Main(){       Uri newURI1 = new Uri("https://www.tutorialspoint.com/index.htm");       Console.WriteLine("URI = "+newURI1);       Uri newURI2 = new Uri("https://www.qries.com/");       Console.WriteLine("URI = "+newURI2);       if(newURI1.Equals(newURI2))          Console.WriteLine("Both the URIs are equal!");       else       ...

Read More

Uri.IsHexEncoding() Method in C#

AmitDiwan
AmitDiwan
Updated on 14-Nov-2019 108 Views

The Uri.IsHexEncoding() method in C# determines whether a character in a string is hexadecimal encoded.SyntaxFollowing is the syntax −public static bool IsHexEncoding (string pattern, int index);Above, the pattern parameter is the string to check, whereas the index is the location in pattern to check for hexadecimal encoding.ExampleLet us now see an example to implement the Uri.IsHexEncoding() method −using System; public class Demo {    public static void Main(){       string pattern = "%50";       bool res = Uri.IsHexEncoding(pattern, 0);       if (res)          Console.WriteLine("Valid: Hexadecimal Encoded");       else   ...

Read More

Bash program to check if the Number is a Prime or not

sudhir sharma
sudhir sharma
Updated on 13-Nov-2019 19K+ Views

Bash also known as GNU bash is a command language and unix shell script is a command line interpreter for operating system. It was designed by Brian Fox and was a free software which replaced Bourne shell. It first released in 1989 and some became go to for login shell for linux based operating systems like macOS, Linux based softwares, etc.Prime number is a number that has only two factors i.e. the number itself and 1. For example, 2 , 3 , 5, 7 , 11 , 13 , 17 , 19 , 23 , 29….Here we are given a ...

Read More
Showing 54711–54720 of 61,248 articles
Advertisements