Array Logics
Array Logics
10. Display first element of array only if the array has elements
13. Display first element of integer array is Even or not only if it is positive.
14. Print the multiplication table for first element of integer array.
16. Find the factorial for first element in integer array only if the element between 2 and 8
17. Check the first element bigger than second element in the given array.
18. Find the largest number of first 2 numbers in given array only if both elements are positive.
19. Program to find the sum of first and elements from given array.
22. Program to swap the index element with next element – Error if the next element is not
present.
29. Program to find the sum of array elements using for each loop
30. Program to find the sum of array elements using for loop
31. Program to display even numbers in the array using for each loop
32. Program to display odd numbers in the array using for loop
34. Program to find the sum of even numbers in the array using for each loop
35. Program to find the sum of odd numbers in the array using for loop
37. Program to print the numbers which are higher than average of all elements in the array
38. Program to print the multiplication table of each number in the array
39. Program to find the factorial value for each number in the array.
40. Program to print the factors for each number in the given array.
41. Program to print factors count for each number in the given array.
46. Program to swap first even and last odd in the given array.
50. Program to find the first occurrence of specified element in the given array
51. Program to find the last occurrence of specified element in the given array
52. Program to create new array with inserting element into specified location
54. Program to find the first repeating element in the given array
55. Program to create new array by deleting first occurrence specified element in the array.
56. Program to create new array by deleting all occurrences of specified element in the array.
58. Program to reverse all elements in the given array without second array.
59. Program to find the first non-repeating element in the given array.
60. Program to read the size of array from user and construct array object.
61. Program to read integers from end user and store into array
65. Program to check whether the element is duplicated or not in the array.
70. Program to display elements in array which are divisible by both 3 and 5
71. Program to find the average of array elements which are divisible by either 4 or 7
75. Program to find the difference between 2 arrays of elements with same length.
76. Program to find the difference between 2 arrays of elements with different length
77. Program to find the sum of all elements in an array except for a given index.
78. Program to find the sum of all elements in an array except for the largest element.
79. Program to find the sum of all elements in an array except for the smallest element.
80. Program to find the sum of all elements in an array except for the first and last elements.
81. Program to find the sum of all elements in an array except for the first and second largest
elements.
82. Program to find the sum of all elements in an array except for the first and second smallest
elements.
83. Program to find the sum of all elements in an array except for the elements at even indices.
84. Program to find the sum of all elements in an array except for the elements at odd indices.
85. Program to find the difference between the largest and smallest elements in an array.
86. Program to find the difference between the second largest and second smallest
87. Program to construct array with only even numbers from given array
88. Program to constructor array with only odd numbers from given array
89. Program to construct 2 arrays with even and odd numbers from given array.
91. Program to find the sum of first negative & last positive number from the given array.
94. Program to arrange even numbers to left side and odd numbers to right side in the given
array.
95. Program to find the second largest element in the given array.
96. Program to test the equality of 2 arrays without using pre-defined method.
98. Write a program to find the index difference between smallest and largest element of given
array.
99. Find the average value or array elements except smallest and largest element in that array.
101. Program to find the sum of two elements in the array which is equal to the given number.
117. Program to find the length of the longest increasing subsequence in an array
125. program to find the length of the longest decreasing subsequence in an array
128. Re-arrange the array with alternate even and odd numbers
129. Create the Wave array from the given array of elements
135. Write a program to create a 2D array of integers and print its elements in row-major order.
136. Write a program to create a 2D array of integers and print its elements in column-major
order.
137. Write a program to create a 2D array of integers and find the maximum element in it.
138. Write a program to create a 2D array of integers and find the minimum element in it.
139. Write a program to create a 2D array of integers and calculate the sum of all its elements.
142. Write a program to create a 2D array of integers and calculate the average of all its
elements.
143. Write a program to create a 2D array of integers and calculate the sum of each row and
print it.
144. Write a program to create a 2D array of integers and calculate the sum of each column and
print it.
146. Write a program to create a 2D array of integers and sort it in ascending order.
147. Write a program to create a 2D array of integers and sort it in descending order.
148. Write a program to create a 2D array of integers and find the second largest element in it.
149. Write a program to create a 2D array of integers and find the second smallest element in it.