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
Briefly explain how server form post-back works ?  Post Back: The process in which a Web page sends data back to the similar page on the server. View State : View State i

What is DMAIC and DMADV? The Six Sigma has two key methodologies viz. DMAIC and DMADV. The DMAIC is used to improve an existing business process. While DMADV is used to create

I need C# Programmer Project Description: To help in the production of a C# module to provide a web service. We are based in Littlehampton, West Sussex. Skills required ar

When we create a private constructor, we can not create object of the class directly from the client. So you will use the private constructors whenever you do not want instances of

I need Export Data using JSON Project Description: We could like to share our data with other websites via JSON. We are presently using Entity Framework with MySQL. We req

How do we assign page specific attributes? The Page attributes are specified by using the @Page directive.

This assignment is about writing a C# application that creates a minimal student enrolment system. The application will display lists of papers and students. The user can enrol stu

What precautions we need to take while deploying satellite assemblies? When we distribute the assembly, the folder structure has to be very organized. The table below shows how

What are the different Visual Basic features that support LINQ? Visual Basic includes the following features that support LINQ: Anonymous types - Enables you to make a ne

What is Manifest? Assembly metadata is keeps in Manifest. Manifest contains all the metadata required to do the following things     Version of assembly.     Security ide