Sorting 2 arrays & merging into 1 - c# program, DOT NET Programming

Sorting 2 Arrays & Merging into 1 - C# Program

Hello, i didn't find the correct way to implement Array in my project. I am beginner for this language.  Please suggest me some examples.

Posted Date: 2/12/2013 1:14:14 AM | Location : United States





Hey this a very easy code for your problem try this.

Program:

using System;

class SortArray

{

  public static void Main()

 {

   int [] A={127,157,240,550,510};  

   int [] B={275,157,750,255,150};

   int CLength=(A.Length +B.Length);

   int [] C=new int[CLength];

   int i=0,j=0,k;    

  Console.Writeline ("Sorted array list : ");

   for(k=0;k<=(i+j);k++)

  {

    if(A[i]<=B[j])

   {

    C[k]=A[i];

    Console.Write (C[k] + " ");

     if(i<4) 

    {

     i++;

    }

   }

    else

   {

    C[k]=B[j];

    Console.Write (C[k] + " ");

     if(j<4)

    {

     j++;

    }

   }

  }

   for(i=0;i<CLength;i++)

  {

   Console.Write(C[i] + " ");

  }

  Console.ReadLine();

 }

}

Posted by Amy | Posted Date: 2/12/2013 1:15:15 AM


Related Discussions:- Sorting 2 arrays & merging into 1 - c# program, Assignment Help, Ask Question on Sorting 2 arrays & merging into 1 - c# program, Get Answer, Expert's Help, Sorting 2 arrays & merging into 1 - c# program Discussions

Write discussion on Sorting 2 arrays & merging into 1 - c# program
Your posts are moderated
Related Questions
The ASP.NET impersonation is totally controlled by entries in the applications web.config file. Default setting is "no impersonation". You can explicitly describe  that ASP.NET sho

show the dot net topic

how can we use entity framework in ASP.Net MVC

Explain the DataAdapter.Update() and DataSetAcceptChanges() methods. The DataAdapter.Update() method calls any of the DML statements, like UPDATE, INSERT, or DELETE statements,

Reversing the Numbers - C# Program Hello guys i need your advice. How can i reverse the integer number in c# project? Please recommend some examples.

What are function points? The FPA is breaking huge systems into smaller pieces and analyzing them. The Software application is a combination of set of elementary processes. The

Question: (a) List the two main advantages of developing a Multitiered Web Applications. (b) Explain how Validation controls are used to validate forms. (c) Using com

How can COM Components use in .NET? The .NET components can communicate with COM using RCW (Runtime Callable Wrapper). The ways with which you can generate RCW are as shown bel

MVC -C# Single Page Application Project Description: Construct a site similar to prototype: To explain briefly: 1) Single Page Application 2) Loginig funcionality

Define importance of Vitamin c Freezing preserves vegetable and nutrients to a great extent. Vitamin A and β-Carotene are well preserved in spinach, peas and beans, or are mode