Programming examples of Array in C#

example
In this chapter you will learn about some programming examples of array in C#.

Qu 1:Write a program of sorting an array. Declare single dimensional array and accept 5 integer values from the user. Then sort the input in ascending order and display output.

Answer

Output

Enter number:      56
Enter number:      34
Enter number:      23
Enter number:      1
Enter number:      76Elements of array are:56      34      23      1      76

Elements of array are:

1       23      34      56      76
__

 

Qu2:Write a program to create two multidimensional arrays of same size. Accept value from user and store them in first array. Now copy all the elements of first array are second array and print output.

Answer

Output

Enter your option <1-7> for days. 1 for Monday: 9
Invalid option. Please try againEnter your option <1-7> for days. 1 for Monday: 2
Tuesday
__

 

Summary

In this chapter you studied some programming examples of array. In next chapter you will get some programming exercises of array.

Write a Reply or Comment

Your email address will not be published.