Tag: arrays

C# example of 1 dim and 2 dim arrays

In these examples, the dimensions of the array are input by the user ///////////// Declaring 1 - dimensional arrays using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication2 { class Program { static void Main(string args) { // declaration of integer array int myArray1 = new int[5]; int myArray2 = { 10,

C# examples of if-else, switch statement, nested case, nested for loop, while loop, jump statements, string arrays, array searching

C# examples of control structures, arrays, and searching ////////////// Nested IF - Else example using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace ConsoleApplication1 { class Program { static void Main(string args) { Console.WriteLine("Type in a string"); string input; input = Console.ReadLine(); if (input == "") { Console.WriteLine("You typed in an

arrays in javascript

In this example, we learn how to create an array in javascript and how to traverse array. How to perform various built-in operations on array elements, such as sorting, etc. <html> <head> <title></title> <script language="javascript" type="text/javascript"> var instruments = new Array("piano", "drum", "flute"); //document.write(instruments.length); //document.write(instruments.toString()); var myarray = new Array(); myarray[0] = "pen"; myarray[1] =