Found 26504 Articles for Server Side Programming

How to change the WindowLeft of the Console

AmitDiwan
Updated on 14-Nov-2019 06:47:00

137 Views

Use the Console.WindowLeft Property to change the WindowLeft of the Console in C#.ExampleLet us now see an example −using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Demo {    public static void Main (string[] args) {       Console.InputEncoding = Encoding.ASCII;       Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);       Console.OutputEncoding = Encoding.ASCII;       Console.WriteLine("Output Encoding Scheme = "+Console.OutputEncoding);       Console.CursorVisible = false;       Console.Write("Cursor is Visible? "+ Console.CursorVisible);       Console.WindowLeft = 50;       Console.Write("WindowLeft = "+Console.WindowLeft);    } } OutputThis will produce ... Read More

How to change the WindowHeight of the Console in C#?

AmitDiwan
Updated on 14-Nov-2019 06:44:04

143 Views

Use the Console.WindowHeight Property to change the WindowHeight of the Console.ExampleLet us now see an example −using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Demo {    public static void Main (string[] args) {       Console.InputEncoding = Encoding.ASCII;       Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);       Console.OutputEncoding = Encoding.ASCII;       Console.WriteLine("Output Encoding Scheme = "+Console.OutputEncoding);       Console.CursorVisible = false;       Console.Write("Cursor is Visible? "+ Console.CursorVisible);       Console.WindowHeight = 30;       Console.Write("WindowHeight = "+Console.WindowHeight);    } }OutputThis will produce the following output −Input ... Read More

How to change the visibility of the Cursor of Console in C#

AmitDiwan
Updated on 14-Nov-2019 06:43:18

414 Views

To change the visibility of the Cursor, use the Console.CursorVisible property.ExampleLet us see an example −using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Demo {    public static void Main (string[] args) {       Console.BackgroundColor = ConsoleColor. Black;       Console.WriteLine("Background color changed = "+Console.BackgroundColor);       Console.ForegroundColor = ConsoleColor.White;       Console.WriteLine("Foreground color changed = "+Console.ForegroundColor);       Console.InputEncoding = Encoding.ASCII;       Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);       Console.OutputEncoding = Encoding.ASCII;       Console.WriteLine("Output Encoding Scheme = "+Console.OutputEncoding);       Console.CursorVisible = false;   ... Read More

MathF.Log10() Method in C# with Examples

AmitDiwan
Updated on 14-Nov-2019 06:40:51

74 Views

The MathF.Log10() method in C# is used to return the base 10 logarithm of a specified number.SyntaxFollowing is the syntax −public static float Log10 (float val);Above, Val is the number whose logarithm is to be calculated.ExampleLet us now see an example to implement the MathF.Log10() method −using System; public class Demo {    public static void Main(){       float val1 = 45.9f;       float val2 = -4.35f;       Console.WriteLine(MathF.Log10(val1));       Console.WriteLine(MathF.Log10(val2));    } }OutputThis will produce the following output −1.661813 NaNExampleLet us now see another example to implement the MathF.Log10() method −using ... Read More

MathF.Log() Method in C# with Examples

AmitDiwan
Updated on 14-Nov-2019 06:38:15

68 Views

The MathF.Log() method in C# is used to return the logarithm of a specified number.SyntaxFollowing is the syntax −public static float Log (float val);Above, Val is the specified number whose natural (base e) logarithm to be calculated.ExampleLet us now see an example to implement the MathF.Log() method −using System; public class Demo {    public static void Main(){       float val1 = 0.0f;       float val2 = 1.0f;       Console.WriteLine(MathF.Log(val1));       Console.WriteLine(MathF.Log(val2));    } }OutputThis will produce the following output −-Infinity 0ExampleLet us now see another example to implement the MathF.Log() method ... Read More

MathF.IEEERemainder() Method in C# with Examples

AmitDiwan
Updated on 14-Nov-2019 06:36:09

59 Views

The MathF.IEEERemainder() method in C# is used to return the remainder resulting from the division of a specified number by another number.SyntaxFollowing is the syntax −public static float IEEERemainder (float dividend, double float);ExampleLet us now see an example to implement the MathF.IEEERemainder() method −using System; public class Demo {    public static void Main(){       float val1 = 90.5f;       float val2 = 13.5f;       float rem = MathF.IEEERemainder(val1, val2);       Console.WriteLine(rem);    } }OutputThis will produce the following output −-4ExampleLet us now see another example to implement the MathF.IEEERemainder() method −using ... Read More

MathF.Floor() Method in C# with Examples

AmitDiwan
Updated on 14-Nov-2019 06:32:56

145 Views

The MathF.Floor() method in C# is used to find the largest integer, which is less than or equal to the specified float value.SyntaxFollowing is the syntax −public static float Floor (float val);Above, the Val is the floating-point value.ExampleLet us now see an example to implement the MathF.Floor() method −using System; class Demo {    public static void Main(){       float val = 45.67f;       float res = MathF.Floor(val);       Console.WriteLine("MathF.Floor() = "+res);    } }OutputThis will produce the following output −MathF.Floor() = 45ExampleLet us now see another example to implement the MathF.Floor() method −using ... Read More

How to change the Output Encoding Scheme of the C# Console?

AmitDiwan
Updated on 14-Nov-2019 06:31:08

355 Views

Use the Console.OutputEncoding property in C# to change the Output Encoding Scheme in C#.ExampleLet us see an example −using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Demo {    public static void Main (string[] args) {       Console.BackgroundColor = ConsoleColor. Black;       Console.WriteLine("Background color changed = "+Console.BackgroundColor);       Console.ForegroundColor = ConsoleColor.White;       Console.WriteLine("Foreground color changed = "+Console.ForegroundColor);       Console.InputEncoding = Encoding.ASCII;       Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);       Console.OutputEncoding = Encoding.ASCII;       Console.WriteLine("Output Encoding Scheme = "+Console.OutputEncoding);    } }OutputThis will produce the following output −

How to change the Input Encoding Scheme of the C# Console?

AmitDiwan
Updated on 14-Nov-2019 06:27:24

172 Views

To change the Input Encoding Scheme of the Console, use the Console.InputEncoding property.ExampleLet us see an example −using System; using System.Collections.Generic; using System.Threading.Tasks; using System.Linq; using System.Text; 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.InputEncoding = Encoding.ASCII;       Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);       Console.CursorTop = 20;       Console.WriteLine("CursorTop = "+Console.CursorTop);    } }OutputThis will produce the following output −

MathF.Min() Method in C# with Examples

AmitDiwan
Updated on 14-Nov-2019 06:25:24

85 Views

The MathF.Min() method in C# returns the smallest of the two specified numbers.SyntaxFollowing is the syntax −public static float Min (float val1, float val2);Above, val1 is the first number, whereas val2 is the second number. Both of these numbers are compared.ExampleLet us now see an example to implement the MathF.Min() method −using System; public class Demo {    public static void Main(){       float val1 = 6.89f;       float val2 = 4.45f;       Console.WriteLine("Minimum Value = "+MathF.Min(val1, val2));    } }OutputThis will produce the following output −Minimum Value = 4.45ExampleLet us now see another ... Read More

Advertisements