C# Program to Print the Sum of all the Multiples of 3 and 5

using System; namespace ConsoleApp2 { class Program { public static void Main() { int number, i, k, count = 1; Console.Write(“Enter number of rows\n”); number = int.Parse(Console.ReadLine()); count = number – 1; for (k = 1; k <= number; k++) { for (i = 1; i <= count; i++) Console.Write(” “); count–; for (i = […]

Read More

C# Program to Display Numbers in the form of Triangle

using System; class Pascal { public static void Main() { int[,] arr = new int[8, 8]; for (int i = 0; i < 8; i++) { for (int k = 7; k > i; k–) { //For loop to print spaces Console.Write(” “); } for (int j = 0; j < i; j++) { if […]

Read More

Count the frequency of each element of an array

In this program, we will count the frequency of each element of an array. Example: Elements in the array [1,8,4,2,8,1,4,8,9,8] Output: 1 occurs 2 times 8 occurs 4 times 4 occurs 2 times 2 occurs 1 times 9 occurs 1 times   using System; namespace ConsoleApp2 { class Program { static void Main(string[] args) { […]

Read More

Extension methods in C#

Extension methods are a new feature in C# 3.0. An extension method enables us to add methods to existing types without creating a new derived type, recompiling, or modify the original types. We can say that it extends the functionality of an existing type in .NET. An extension method is a static method to the […]

Read More

Difference between Value Type and Reference Type

Value Type Reference Type Data stored in stack memory Data stored in heap memory When passed as value type new copy is created and passed so changes to variable does not get reflected back. When passed as Reference type then reference of that variable is passed so changes to variable does get reflected back. Value […]

Read More

Overloading vs Overriding in JavaScript

JavaScript does not support overloading. JavaScript supports overriding, so if you define two functions with the same name, the last one defined will override the previously defined version and every time a call will be made to the function, the last defined one will get executed. Example: <script type=”text/javascript”> function sum(x, y, z) { return […]

Read More