Fun Gadget World, Samsung Tool PRO, Android Multi Tools, Android Jelly Bean, stock firmware, AT&T Connect, Ulefone Tiger, techno n8 and Octopus Box LG Setup

C# Program which takes n values from user and then sort them using Bubble sort

C# Program which takes n values from user and then sort them using Bubble sort - a lot of websites that discuss information about gadgets, including this blog Fun Gadget World we discuss all the information from various brands of gadgets, from the old to the latest, which is very dear if you miss, now we discuss first about C# Program which takes n values from user and then sort them using Bubble sort we have collect lots of data to create this article so that you get complete information, so please read it:

Articles : C# Program which takes n values from user and then sort them using Bubble sort
full Link : C# Program which takes n values from user and then sort them using Bubble sort
Article Csharp, Article programs,

You can also see our article on:


C# Program which takes n values from user and then sort them using Bubble sort

C# Program which takes n values from user and then sort them using Bubble sort

Program Statement:
Write a program which takes n values from user and then sort them using Bubble sort

Solution:
 public class bubble
{
int n, x, y, z;
public void sort()
{
System.Console.Write("\n\t\tEnter length of array : ");
n = Convert.ToInt32(System.Console.ReadLine());
int[] array = new int[n + 1];
int[] temp1 = new int[n + 1];
int[] temp2 = new int[n];
System.Console.WriteLine("\n\t\tEnter {0} numbers : ", n);
for (x = 0; x < n; x++)
{
array[x] = Convert.ToInt32(System.Console.ReadLine());
}
for (y = n; y > 0; y--)
{
for (z = 0; z < y; z++)
{
if (array[z] > array[z + 1])
{
temp1[z] = array[z];
array[z] = array[z + 1];
array[z + 1] = temp1[z];
temp2[z] = array[z + 1];
}
else
{ temp2[z] = array[z]; }
}
}
Console.WriteLine("\n\t\t>>>Ordered List<<< \n");
for (int i = 0; i < n; i++)
{
Console.WriteLine("\n\t\t\t{0}", temp2[i]);
}
}
}




information C# Program which takes n values from user and then sort them using Bubble sort has been completed in the discussion

hopefully the information C# Program which takes n values from user and then sort them using Bubble sort can be useful for you in looking for references about technology gadgets,

you just finished reading information about C# Program which takes n values from user and then sort them using Bubble sort if you want to bookmark or share this link please use link https://indiafunworld.blogspot.com/2014/01/c-program-which-takes-n-values-from.html please also visit to other page to get more information.

Tag : , ,
Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : C# Program which takes n values from user and then sort them using Bubble sort

  • C# Program for Array solving problemsC# Program for Array solving problemsProgram Statement:Write a function which takes four arrays of same size as arguments; array1, array2, array3, array4. The function w ...
  • C# Program to Print half Diamond shapes using numbersC# Program to Print half Diamond shapes using numbers 1 to 10Program Statement:Write a program to produce the following output:            ...
  • C# Program to Print ASCII Values Using do-while LoopC# Program to Print ASCII Values Using do-while LoopProgram Statement:Write a program to print all the ASCII values and their equivalent characters using a do-while loop ...
  • C# Program using Functions and loopsC# Program using FunctionsProgram Statement:Write a function which takes one value as parameter and display the sum of digits in the value. e.g. if user has passed 125 t ...
  • C# Program to solve different problemsC# Program to solve different problemsProgram Statement:Write a program which will take input a character ‘a’ value from user. You have to use switch statement to decide ...

0 komentar:

Posting Komentar