1D Array Related Problems01
1D Array Related Problems01
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 integer numbers into an array, and then sum up all the even indexed *
integers in that array.
6. WAP that will take n integer numbers into an array, and then find the maximum - **
minimum among them with its index position.
7. WAP that will take n alphabets into an array, and then count number of vowels in that *
array.
8. 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”.
10. WAP that will first take n integers into an array A and then m integers into array B. Now **
swap all elements between array A and B. Finally show all elements of both array A and B.
11. 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.
12. 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
14. WAP that will take n integers into an array A and m positive integers into array B. Now **
find the intersection (set operation) of array A and B.
15. 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.
7 25
1111111
1111111
1111111
1111111
1111111
1111111
1111111
18. WAP that will take (n x n) integer inputs into a square matrix of dimension n (where n **
must be an odd number). Then calculate sum of the integers based on following position
pattern (consider only the boxed position during the sum). Please see the input-output.
7 33
1111111
1111111
1111111
1111111
1111111
1111111
1111111
19. WAP that will take (m x n) integer inputs into a matrix of dimension m x n. Now reverse **
that matrix within itself and display it. Reversal means swap 1st column with the nth
column, swap 2nd column with the (n-1)th column and so on…
20. WAP that will take (n x n) integer inputs into a square matrix of dimension n. Now **
determine whether the matrix is symmetric or not.
Reference: http://en.wikipedia.org/wiki/Symmetric_matrix
21. WAP that will take (m x n) positive integer inputs into a matrix of dimension m x n. Now ***
replace all the duplicate integers by -1 in that matrix. Finally display it.