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
hello there im stuck in my project and need to finish off it in a week or 8 days ,,and its .net and databases..please need a help

What is the difference between thread and process? The thread is a path of execution which can run on CPU; a process is a collection of threads that share the same virtual memo

What are the various objects in Dataset? The Dataset has a collection of DataTable object inside the Tables collection. Every DataTable object have  a collection of DataRow obj

Counting Number of Words in a String - C# Program Anyone can suggest me the output of the following program. using System;   class CountWords { public static void

how can i construct er diagram for payroll managment

How to use a checkbox in a datagrid? The steps to be done are as follows:- 1)    In the ASPX page you have to add Itemtemplate tag in datagrid. 2) I

Assignment for inheritance based on c#

Project Description: I am preparing a speech recognition program and need a quick code to get it done I am seeking for someone to create a Gmail API that can get subject, and co

Program of Nested Loop - C# Program I am a learner of C# language and i am struggling with the Loops in c#. Can you have any code examples for this.

How do I write common code for different dot net framework data providers?