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
Custom Login Page for SharePoint 2013 with Active Directory Project Description: I would like to prepare a webpart or an application for Sharepoint 2013 foundation. The we

How do we access view state value of the page in the next page? The View state is page specific; it contains information about controls embedded at the particular page. ASP.NET

Custom authentication: If we don't need ASP.NET to perform any authentication, we can set the authentication mode to none. The reason behind this decision could be: We don't

What are benefits and limitations of using Hidden frames 1)    The benefits of using hidden frames are as follows: 2)    More than one data field can cache. 3)    The abi

Develop a Rummikub Game Project Description: I require a game(Rummikub) multiplayer with source codes. I have done to much but i need to help me in Algorithm who can check

What are similarities between Class and structure? The similarities between structures and classes are as follows:- 1) Both can have constructors, properties, methods, field

What are major difference between classic ADO and ADO.NET ? Some major differences between the classic ADO & ADO.NET are as follows: 1) As in the classic ADO we had server a

Develop a scrapebox software Project Description: I need a software name scrapebox Skills required are .NET, C Programming, Java, C# Programming, Software Architecture

What are the authentication methods in .NET? 1.Windows authentication 2.Forms authentication 3.Passport authentication 4.None/custom authentication

Set up a FTP File Server and active FTP File Transfer using VB.NET The Job Description is as given: 1. Manually set up a FTP file server on a remote server. 2. Manually ad