Problem Set 5 - Problems On Arrays
Problem Set 5 - Problems On Arrays
2. WAP that will take n integer numbers into an array, and then sum up all the integers in *
that array.
3. WAP that will take n integer numbers into an array, and then sum up all the even integers in that *
array.
4. WAP that will take n floating point numbers into an array, and then find the average of those *
numbers.
5. WAP that will take n integer numbers into an array, and then sum up all the even indexed *
integers in that array.
Sample input Sample output
5 9
1 2 3 4 5
6 5
2 8 3 9 0 1
6. Wap that will take n integer numbers in an array, n different integer numbers in a second
array and put the sum of the same indexed numbers from the two arrays in a third array.
7. WAP that will take n integer numbers into an array, and then reverse all the integers **
within that array. Finally print them all from 0 index to last valid index.
8. WAP that will take n integer numbers into an array, and then find the maximum - **
minimum among them with its index position.
9. WAP that will take n alphabets into an array, and then count number of vowels in that *
array.
Sample input Sample output
7 Count: 5
AKIOUEH
29 Count: 13
UNITEDINTERNATIONALUNIVERSITY
10. WAP that will take n integers into an array, and then search a number into that array. If *
found then print its index. If not found then print “NOT FOUND”.
12. WAP that will take n integer numbers as input in an array and then insert a number in a **
position specified by the user in the array.
15. WAP that will take n positive integers into an array A. Now find all the integers that are *
divisible by 3 and replace them by -1 in array A. Finally show all elements of array A.
Sample input Sample output
8 7 8 1 -1 2 -1 4 -1
78132643
3 -1 2 1
321
16. WAP that will take n positive integers into an array A. Now find all the integers that have
an odd index and replace them by 0 in array A. Finally show all elements of array A.
17. WAP that will take n integers into an array A. Now sort them in ascending order within ***
that array. Finally show all elements of array A.
Reference: http://en.wikipedia.org/wiki/Bubble_sort
19. WAP that will take n integers into array A and m positive integers into array B. Now find **
the intersection (set operation) of array A and B.
20. WAP that will take n integers into an array A and m positive integers into array B. Now **
find the union (set operation) of array A and B.