Qu. Write a program to sort one dimensional array in ascending order using static method
Answer
- using System;
- namespace Sort_Array
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- int[] num= {22,50,11, 2, 49};
- Array.Sort(num);
- for(int i=0; i<num.Length; i++)
- {
- Console.Write(num[i] + " ");
- }
- }
- }
- }
Output
2 11 22 49 50
_