- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2628 Articles for Csharp
686 Views
Shell Sort allows the exchange of items that are far apart in the array and then reduces the gap between them. This is a sort of generalization of Insertion Sort. Shell Sort is known as such as it was published by Donald Shell at first.A program that demonstrates shell sort in C# is given as follows −Example Live Demousing System; namespace ShellSortDemo { public class Example { static void shellSort(int[] arr, int n) { int i, j, pos, temp; pos = 3; while (pos > ... Read More
4K+ Views
A number can be multiplied by 2 using bitwise operators. This is done by using the left shift operator and shifting the bits left by 1. This results in double the previous number.A program that demonstrates multiplication of a number by 2 using bitwise operators is given as follows.Example Live Demousing System; namespace BitwiseDemo { class Example { static void Main(string[] args) { int num = 25, result; result = num
2K+ Views
Merge Sort is a sorting algorithm that uses the divide and conquer method. It divides the array into two parts and then calls itself for each of these two parts. This process is continued until the array is sorted.A program that demonstrates merge sort in C# is given as follows −Example Live Demousing System; namespace QuickSortDemo { class Example { static public void merge(int[] arr, int p, int q, int r) { int i, j, k; int n1 = q - p + 1; int ... Read More
9K+ Views
The program for matrix multiplication is used to multiply two matrices. This procedure is only possible if the number of columns in the first matrix are equal to the number of rows in the second matrix.A program that demonstrates matrix multiplication in C# is given as follows −Example Live Demousing System; namespace MatrixMultiplicationDemo { class Example { static void Main(string[] args) { int m = 2, n = 3, p = 3, q = 3, i, j; int[, ] a = {{1, 4, 2}, {2, 5, 1}}; ... Read More
5K+ Views
Quick Sort is a sorting algorithm that uses the divide and conquer method. It takes a pivot element and places it in its correct position. Then the array to the left and right of the pivot element are again sorted using Quick Sort. This is done until the whole array is sorted.A program that demonstrates Quick Sort using Recursion in C# is given as follows −Example Live Demousing System; namespace QuickSortDemo { class Example { static public int Partition(int[] arr, int left, int right) { int pivot; pivot = ... Read More
577 Views
Usage of pointers in C# require the unsafe modifier. Also array elements can be accessed using pointers using the fixed keyword. This is because the array and the pointer data type are not the same. For example: The data type int[] is not the same as int*.A program that demonstrates accessing array elements using pointers is given as follows.Exampleusing System; namespace PointerDemo { class Example { public unsafe static void Main() { int[] array = {55, 23, 90, 76, 9, 57, 18, 89, 23, 5}; int n = ... Read More
1K+ Views
An IP Address is an Internet Protocol address that is a series of numbers assigned to each device on a computer network. In C#, the class IPAddress class in the namespace System.Net deals with IP addresses.A program that is used to validate an IP address is given as follows −Example Live Demousing System; using System.Net; using System.Net.Sockets; using System.Text.RegularExpressions; namespace IPaddressDemo { class Example { public static void Main() { IPAddress IP; Console.WriteLine("Enter the IP Address: "); string ipAddr = Console.ReadLine(); ... Read More
4K+ Views
A Pascal’s triangle contains numbers in a triangular form where the edges of the triangle are the number 1 and a number inside the triangle is the sum of the 2 numbers directly above it.A program that demonstrates the creation of the Pascal’s triangle is given as follows.Example Live Demousing System; namespace PascalTriangleDemo { class Example { public static void Main() { int rows = 5, val = 1, blank, i, j; Console.WriteLine("Pascal's triangle"); for(i = 0; i
3K+ Views
Implementation of FizzBuzz involves printing numbers from 1 to 100. If the numbers are multiples of 3 then Fizz is printed. If they are multiples of 5, then Buzz is printed and if they are multiples of both 3 and 5 then FizzBuzz is printed.A program that demonstrates the implementation of FizzBuzz is given as follows.Example Live Demousing System; namespace FizzBuzzDemo { public class example { static void Main(string[] args) { for (int i = 1; i