Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 2111 of 2650
5K+ Views
The Math.Sqrt() method in C# is used to compute the square root of the specified number.SyntaxFollowing is the syntax −public static double Sqrt (double val);Above, Val is the number for which we want the square root.ExampleLet us now see an example to implement Math.Sqrt() method −using System; public class Demo { public static void Main(){ double val1 = 4; double val2 = 36; Console.WriteLine(Math.Sqrt(val1)); Console.WriteLine(Math.Sqrt(val2)); } }OutputThis will produce the following output −2 6ExampleLet us see another example to implement Math.Sqrt() method −using System; public class ... Read More
4K+ Views
The DateTime.AddYears() method in C# is used to add the specified number of years to the value of this instance. It returns new DateTime.SyntaxFollowing is the syntax −public DateTime AddYears (int yrs);Above, yrs are the years to be added. If you want to subtract years, then use a negative value.ExampleLet us now see an example to implement the DateTime.AddYears() method −using System; public class Demo { public static void Main(){ DateTime d1 = new DateTime(2019, 11, 20, 6, 20, 40); DateTime d2 = d1.AddYears(5); Console.WriteLine("Initial DateTime = {0:dd} {0:y}, {0:hh}:{0:mm}:{0:ss} ... Read More
5K+ Views
The Math.Pow() method in C# is used to compute a number raised to the power of some other number.SyntaxFollowing is the syntax −public static double Pow(double val1, double val2)Above, val1 is a double-precision floating-point number to be raised to a power., whereas val2 is a double-precision floating-point number that specifies a power.ExampleLet us now see an example to implement Math.Pow() method −using System; public class Demo { public static void Main(){ double res; res = Math.Pow(5, 0); Console.WriteLine("Math.Pow(5, 0) = "+res); res = Math.Pow(0, 5); ... Read More
3K+ Views
The Math.Min() method in C# is used to return the larger of two specified numbers. This method works for both the numbers being Double, Decimal, Int16, Int32, etc.SyntaxFollowing is the syntax −public static ulong Min (ulong val1, ulong val2); public static uint Min (uint val1, uint val2); public static ushort Min (ushort val1, ushort val2); public static float Min (float val1, float val2); public static byte Min (byte val1, byte val2); public static long Min (long val1, long val2);ExampleLet us now see an example to implement Math.Min() method −using System; public class Demo { public static void Main(){ ... Read More
450 Views
The Char.ConvertFromUtf32(Int32) method in C# is used to converts the specified Unicode code point into a UTF-16 encoded string.SyntaxFollowing is the syntax −public static string ConvertFromUtf32 (int utf32);Above, the parameter utf32 is a 21-bit Unicode code point.ExampleLet us now see an example to implement the Char.ConvertFromUtf32(Int32) method −using System; public class Demo { public static void Main(){ int utf = 0x0051; string str = Char.ConvertFromUtf32(utf); Console.WriteLine("Value = "+str); } }OutputThis will produce the following output −Value = QExampleLet us now see another example −using System; public class Demo { ... Read More
546 Views
The Convert.ToByte() method in C# converts the specified string representation of a number to an equivalent 8-bit unsigned integer, using specified culture-specific formatting information.SyntaxFollowing is the syntax −public static byte ToByte (string val, IFormatProvider provider);Above, Val is a string that contains the number to convert. A parameter provider is an object that supplies culture-specific formatting information.ExampleLet us now see an example to implement the Convert.ToByte() method −using System; using System.Globalization; public class Demo { public static void Main(){ CultureInfo cultures = new CultureInfo("en-US"); String str = "5"; Console.WriteLine("Converted byte value..."); ... Read More
6K+ Views
The Math.Max() method in C# is used to return the larger of two specified numbers. This method works for both the numbers being Double, Decimal, Int16, Int32, etc.SyntaxFollowing is the syntax −public static ulong Max (ulong val1, ulong val2); public static uint Max (uint val1, uint val2); public static ushort Max (ushort val1, ushort val2); public static float Max (float val1, float val2); public static byte Max (byte val1, byte val2); public static long Max (long val1, long val2);ExampleLet us now see an example to implement Math.Max() method −using System; public class Demo { public static void Main(){ ... Read More
233 Views
The Tuple class represents a 4-tuple, which is called quadruple. A tuple is a data structure that has a sequence of elements.It is used in −Easier access to a data set.Easier manipulation of a data set.To represent a single set of data.To return multiple values from a methodTo pass multiple values to a methodExampleLet us now see an example to implement the 4-tuple in C# −using System; public class Demo { public static void Main(string[] args) { Tuple tuple = new Tuple("nathan", "steve", "katie", "tim"); Console.WriteLine("Value (Item1)= " + tuple.Item1); ... Read More
419 Views
The Tuple class represents a 3-tuple, which is called triple. A tuple is a data structure that has a sequence of elements.It is used in −Easier access to a data set.Easier manipulation of a data set.To represent a single set of data.To return multiple values from a methodTo pass multiple values to a methodExampleLet us now see an example to implement the 3-tuple in C# −using System; public class Demo { public static void Main(string[] args) { Tuple tuple = new Tuple(35, "steve", "katie"); Console.WriteLine("Value (Item1)= " + tuple.Item1); Console.WriteLine("Value ... Read More
3K+ Views
The DateTimeOffset.Compare() method in C# is used to compare two DateTimeOffset objects and indicates whether the first is earlier than the second, equal to the second, or later than the second. It returns an integer value, 0 − If val1 is later than val2SyntaxFollowing is the syntax −public static int Compare (DateTimeOffset val1, DateTimeOffset val1);Above, val1 is the 1st object to compare, whereas val2 is the 2nd.ExampleLet us now see an example to implement the DateTimeOffset.Compare() method −using System; public class Demo { public static void Main() { DateTimeOffset dateTimeOffset1 = new DateTimeOffset(2019, 09, 09, 8, ... Read More