Arrays Assignment
Arrays Assignment
Assignment # 02
Arrays
Step 1. Start
Step 2. Declare the “N 10” using define.
Step 3. Declare integer Array A[N]
Step 4. Declare integer variable “count”, “i=0”, “j”.
Step 5. Print “Enter the values in first array”
Step 6. Take the input values from user into the elements of
array A.
Step 7. Using two loops “outer” for index i and “inner” loop for
index “j=i+1”
Step 8. If A[i]==A[j] print “A[i]”.
Step 9. End
QUESTION # 04
QUESTION # 05
Step 1. Start.
Step 2. Declare integer array A[3] ,B[3] and C[3]
Step 3. Declare integer variable “count”.
Step 4. Print “Enter the values in first array”
Step 5. Take the input values from user into the elements of array A.
Step 6. Print “Enter the values in second array”.
Step 7. Take the input values from user into the elements of array B.
Step 8. Print value of each element of array A i.e.A[0], A[1], A[2], in
subsequent lines.
Step 9. Print value of each element of array B i.e.B[0], B[1], B[2], in
subsequent lines.
Step 10. Assign the values of “A” array to the “C” array
“C[count]=A[count]”
Step 11. Assign values of “B” array to “A” array. A[count]=B[count]
Step 12. Assign the values of “C” array to the “B” Array
B[count]=C{count]
Step 13. Print “replaced values”
Step 14. Print “values of Array “A” are”
Step 15. Print value of each element of array A i.e.A[0], A[1], A[2], in
subsequent lines.
Step 16. Print “values of Array “B” are”
Step 17. Print value of each element of array B i.e.B[0], B[1], B[2], in
subsequent lines
Step 18. End.
QUESTION # 06
Step 1. Start
Step 2. Declare the integer N.
Step 3. Print “enter the no. of values in array”.
Step 4. Take the input values from user to the no of arrays
Step 5. Declare integer Array A[N]
Step 6. Declare integer variable “count”.
Step 7. Print “Enter the values in first array”
Step 8. Take the input values from user into the elements of array A.
Step 9. Declare and initialize max=A[0], min=A[0].
Step 10. Now compare all the elements of array “arr” with “max”. If a
certain element is greater than “max”, then make “max” equals to
that element.
Step 11. Now compare all the elements of array “arr” with “min”. If a
certain element is less than “min”, then make “min” equals to that
element. Print “max” and “min”.
Step 12. End.
QUESTION # 07
QUESTION # 08
QUESTION # 09
Step 1. Start.
Step 2. Declare 2D arrays a[100][100], b[100][100] and c[100][100].
Step 3. Print “Enter no. of rows in matrix A”.
Step 4. Print “Enter no. of columns in matrix A”.
Step 5. Set size equals to value input by the user.
Step 6. Declare int array a[row][columns]i.e. an array “a” with as much
rows as “row” and as much columns as “columns”.
Step 7. Print “Enter the Values”.
Step 8. Print “Enter no. of rows in matrix B”.
Step 9. Print “Enter no. of columns in matrix B”.
Step 10. Set size equals to value input by the user.
Step 11. Declare int array a[row][columns] i.e. an array “a” with as much
rows as “row” and as much columns as “columns”.
Step 12. Print “Enter the Values”.
Step 13. Print “Matrix A - B”
Step 14. Subtract elements of “a” and “b” with same subscripts and set
“c” element with same subscript equal to it.
Step 15. Print all the element of array “c” with the first three in single
line with sufficient space, the next three in next line, and last three
in last line.
Step 16. End.
QUESTION # 10
Step 1. Start the Program.
Step 2. Declare 2D integer arraysa[3][3],b[3][3],c[3][3].
Step 3. Print “enter the elements of first matrix”
Step 4. Print “Enter the elements of the second matrix”
Step 5. Print the elements of the first matrix in matrix form
Step 6. Print all the element of array “a” with the first three in
single line with sufficient space, the next three in next line, and last
three in last line.
Step 7. Print the elements of the second matrix in matrix form.
Step 8. Print all the element of array “b” with the first three in
single line with sufficient space, the next three in next line, and last
three in last line.
Step 9. Set a loop up to “row”.
Step 10. Set an inner loop up to the “column”.
Step 11. Set another inner loop up to the “column”.
Step 12. Multiply the first (“a” array) and second (“b” array) matrix
and store the element in the third matrix (“c” array):
Step 13. Print the final matrix.
Step 14. Print all the element of array “c” with the first three in
single line with sufficient space, the next three in next line, and last
three in last line.
Step 15. End