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
Looking to build FIFA coins selling and buying website Project Description: I would like a website made for FIFA 14 TEAM. What this website will do is having automatically bu

We have a web based program completed with .NET C# and Microsoft SQL Server. There are some reports requires to be created. Required Skills. - High Proficiency in .NET C#

I want .Net Programmer for custom grid web application Need programmer to support in the development of an ASP .Net interface. Project will make extensive utilize of custom grid

A Super-hero SharePoint developer with great design skills Project Description: US: Our start-up company prepares a very innovative and cool SharePoint related product with c

How to use datagrid view

I need Complete ERP Solution of Jeweler Manufacturing Project Description: MY Project Have Complete ERP Solution of jewellary manufacturing Process. By Using of my software y

What are the methods provided by the command object? The command objects used to connect the connection object to the Datareader or the dataset. The command object provided som

What is a Interface? The Interface is a contract that describes the signature of the functionality. So when a class is implementing a interface it says to the outer world, that

Which namespaces are required to enable the use of databases in ASP.NET pages? The following namespaces are required to enable the use of databases in ASP.NET pages:     Th

Describe session handling in a web farm, how does it work and what are the limits ?    In ASP.NET there are three ways to manage session objects. One support the in-proc mechani