0% found this document useful (0 votes)
21 views

Assignment 7 - Arrays

The document contains instructions for 11 programming assignments involving arrays and matrices: 1) Adding corresponding elements of two arrays and calculating the average, 2) Sorting an array in descending order, 3) Counting odd and even numbers in an array, 4) Exchanging the smallest and largest values in an array, 5) Deleting an element from an array, 6) Inserting an element into an array, 7) Finding the sum of array elements modulo a number, 8) Performing matrix multiplication of 3 matrices, 9) Checking if an array is in palindromic order, 10) Merging two sorted arrays into a new sorted array, and 11) Subtracting two matrices.

Uploaded by

Jeet
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Assignment 7 - Arrays

The document contains instructions for 11 programming assignments involving arrays and matrices: 1) Adding corresponding elements of two arrays and calculating the average, 2) Sorting an array in descending order, 3) Counting odd and even numbers in an array, 4) Exchanging the smallest and largest values in an array, 5) Deleting an element from an array, 6) Inserting an element into an array, 7) Finding the sum of array elements modulo a number, 8) Performing matrix multiplication of 3 matrices, 9) Checking if an array is in palindromic order, 10) Merging two sorted arrays into a new sorted array, and 11) Subtracting two matrices.

Uploaded by

Jeet
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment 7: Arrays

1. WAP to add corresponding elements of two 1-Dimensional arrays and store in the third array,
also calculate the average of the third array.
2. WAP to sort an array in descending order.
3. WAP to count total no of odd and even numbers from the 1-D array.
4. WAP to exchange the smallest and largest values in 1-D array.
5. WAP to delete an element of an array given by the user.
6. WAP to insert an element in an array specified by the user.
7. Given an array arr[] of size N. The task is to find the sum of arr[i] % arr[j] for all valid pairs.
Answer can be large. So, output answer modulo 1000000007
Input: arr[] = {1, 2, 3}
Output: 5
(1 % 1) + (1 % 2) + (1 % 3) + (2 % 1) + (2 % 2)
8. W AP to perform matrix multiplication of 3+ (2 % 3) + (3 % 1) + (3 % 2) + (3 % 3) = 5
*3 matrixes.
9. Given an array of integers of size n, find out if the numbers in the array appear in a palindromic
order. A palindrome is a sequence that reads the same when you flip it. For example, 121 is a
palindrome, 3 is a palindrome, and 234432 is also a palindrome
10. Given two sorted arrays of sizes m and n, write a program that merges the two into another
array of size m + n such that this new array also remains sorted.
11. WAP to subtract 2-D Matrices.

You might also like