Arjun Thakur has Published 1109 Articles

How can we convert subqueries to RIGHT JOIN?

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 10:52:59

125 Views

To make it understand we are using the data from the following tables −mysql> Select * from Customers; +-------------+----------+ | Customer_Id | Name     | +-------------+----------+ | 1           | Rahul    | | 2           | Yashpal  | | 3 ... Read More

Sort the words in lexicographical order in C#

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 10:24:33

780 Views

Firstly, set a string array −string[] arr = new string[] {    "Indian",    "Moroccon",    "American", };To sort the words in lexicographical order −var sort = from a in arr orderby a select a;Example Live DemoLet us see the complete code −using System; using System.Linq; class Program {    static ... Read More

C# program to find K’th smallest element in a 2D array

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 10:07:46

395 Views

Declare a 2D array −int[] a = new int[] {    65,    45,    32,    97,    23,    75,    59 };Let’s say you want the Kth smallest i.e, 5th smallest integer. Sort the array first −Array.Sort(a);To get the 5th smallest element −a[k - 1];Let us see ... Read More

How to find the product of 2 numbers using recursion in C#?

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 10:04:30

172 Views

Firstly, set the two numbers to be multiplied.val1 = 10; val2 = 20;Now cal the method to find the product.product(val1, val2);Under the product method, a recursive call will get you the product.val1 + product(val1, val2 – 1)Let us see the complete code to find the product of 2 numbers using ... Read More

How to find the Average Values of all the Array Elements in C#?

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 09:55:47

147 Views

To find the average values, firstly set an arrayLint[] myArr = new int[10] {    45,    23,    55,    15,    8,    4,    2,    5,    9,    14 };Now find the sum and divide it by the length of the array to get the ... Read More

C# program to check if all the values in a list that are greater than a given value

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 09:47:12

1K+ Views

Let’s say you need to find the elements in the following list to be greater than 80.int[] arr = new int[] {55, 100, 87, 45};For that, loop until the array length. Here, res = 80 i.e. the given element.for (int i = 0; i < arr.Length; i++) {    if(arr[i] ... Read More

How to compile and execute C# programs on Linux?

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 09:38:54

1K+ Views

To compile and execute C# programs on Linux, firstly you need to IDE. On Linux, one of the best IDEs is Monodevelop.It is an open source IDE that allows you to run C# on multiple platforms i.e. Windows, Linux and MacOS. Monodevelop is also known as Xamarin Studio. It has ... Read More

CopyOnWriteArrayList version in C#

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 09:27:52

137 Views

Java has CopyOnWriteArrayList, but C# does not have it. For that, the SynchronizedCollection Class in C#, should be preferred.The SyncronizedCollection has a thread-safe collection containing objects of a type. Here is the syntax.public class SynchronizedCollection : IList, ICollection, IEnumerable, IEnumerable, IList, ICollectionAbove, T is the type of object.The following are ... Read More

C# program to determine if any two integers in array sum to given integer

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 09:21:51

758 Views

The following is our array −int[] arr = new int[] {    7,    4,    6,    2 };Let’s say the given intger that should be equal to sum of two other integers is −int res = 8;To get the sum and find the equality.for (int i = 0; ... Read More

How to print a BinaryTriangle using C#?

Arjun Thakur

Arjun Thakur

Updated on 22-Jun-2020 09:17:39

377 Views

Binary triangle is formed with 0s and 1s. To create one, you need to work around a nestes for loop and display 0s and 1s till the row entered.for (int i = 1; i

Advertisements