Arrays Challenge   Submissions: Five separate files, text format with filenames array1.cs . . . array5.cs 1. Write a program in C# to store elements in an array and print it. Test Data : Input 10 elements in the array : element - 0 : 1 element - 1 : 1 element - 2 : 2 ....... Expected Output : Elements in array are: 1 1 2 3 4 5 6 7 8 9 2. Write a program in C# to read n number of values in an array and display it in reverse order. Test Data : Input the number of elements to store in the array :3 Input 3 number of elements in the array : element - 0 : 2 element - 1 : 5 element - 2 : 7 Expected Output : The values store into the array are : 2 5 7 The values store into the array in reverse are : 7 5 2 3. Write a program in C# to find the sum of all elements of the array. Test Data : Input the number of elements to be stored in the array :3 Input 3 elements in the array : element - 0 : 2 element - 1 : 5 element - 2 : 8 Expected Output : Sum of all elements stored in the array is : 15 4. Write a program in C# to copy the elements of one array into another array. Test Data : Input the number of elements to be stored in the array :3 Input 3 elements in the array : element - 0 : 15 element - 1 : 10 element - 2 : 12 Expected Output : The elements stored in the first array are : 15 10 12 The elements copied into the second array are : 15 10 12 5. Write a program in C# to count a total number of duplicate elements in an array. Test Data : Input the number of elements to be stored in the array :3 Input 3 elements in the array : element - 0 : 5 element - 1 : 1 element - 2 : 1 Expected Output : Total number of duplicate elements found in the array is : 1

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

Arrays Challenge

 

Submissions: Five separate files, text format with filenames array1.cs . . . array5.cs

1. Write a program in C# to store elements in an array and print it.
Test Data :
Input 10 elements in the array :
element - 0 : 1
element - 1 : 1
element - 2 : 2
.......
Expected Output :
Elements in array are: 1 1 2 3 4 5 6 7 8 9


2. Write a program in C# to read n number of values in an array and display it in reverse order.
Test Data :
Input the number of elements to store in the array :3
Input 3 number of elements in the array :
element - 0 : 2
element - 1 : 5
element - 2 : 7
Expected Output :
The values store into the array are :
2 5 7
The values store into the array in reverse are :
7 5 2


3. Write a program in C# to find the sum of all elements of the array.
Test Data :
Input the number of elements to be stored in the array :3
Input 3 elements in the array :
element - 0 : 2
element - 1 : 5
element - 2 : 8
Expected Output :
Sum of all elements stored in the array is : 15


4. Write a program in C# to copy the elements of one array into another array.
Test Data :
Input the number of elements to be stored in the array :3
Input 3 elements in the array :
element - 0 : 15
element - 1 : 10
element - 2 : 12
Expected Output :
The elements stored in the first array are :
15 10 12
The elements copied into the second array are :
15 10 12


5. Write a program in C# to count a total number of duplicate elements in an array.
Test Data :
Input the number of elements to be stored in the array :3
Input 3 elements in the array :
element - 0 : 5
element - 1 : 1
element - 2 : 1
Expected Output :
Total number of duplicate elements found in the array is : 1

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,