0% found this document useful (0 votes)
3 views1 page

1D Array Lab Problems-2

The document outlines a series of programming tasks focused on manipulating a 1D array of integers. Tasks include inputting integers, printing elements in various orders, calculating sums and products, searching for elements, and modifying array values. Each problem statement is designed to enhance understanding of array operations and basic programming concepts.

Uploaded by

vrthakur17
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

1D Array Lab Problems-2

The document outlines a series of programming tasks focused on manipulating a 1D array of integers. Tasks include inputting integers, printing elements in various orders, calculating sums and products, searching for elements, and modifying array values. Each problem statement is designed to enhance understanding of array operations and basic programming concepts.

Uploaded by

vrthakur17
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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.

You might also like