1D Array Lab – Problem Statements
1. Write a program to input 5 integers into an array and print all the elements using a loop.
2. Write a program to print the elements of an array in reverse order.
3. Given an array, display its elements in reverse order. Example: 1 2 3 4 5 54321
4. Write a program to print all even numbers present in the array.
5. Write a program to print all odd numbers present in the array.
6. Write a program to calculate and print the sum of all even numbers in the array.
7. Write a program to calculate and print the sum of all odd numbers in the array.
8. Write a program to calculate the product of all elements in the array.
9. Write a program to find the sum of elements located at even indices of the array.
10. Write a program to find the sum of elements located at odd indices of the array.
11. Write a program to search for a given character in an array and print whether it is
present or not.
12. Write a program to count how many times a user-entered number appears in the array.
13. Write a program to print all the indices where a given element is present in the array.
14. Write a program to replace elements at even indices with -1 and elements at odd indices
with 1.
15. Write a program to search for a given element in the array and replace all its
occurrences with 0.
16. Write a program to count the number of even and odd elements in the array and print
the absolute difference between them.