Professional Documents
Culture Documents
Array Assignment Fast ISL
Array Assignment Fast ISL
NUCES, Islamabad
Q#1: Write a c++ program to check if two 2d arrays of size 3X3 are equal. Values
will be entered by the user in the array.
Q#2: Write a c++ program to print the sum of elements of a 2d array of size 3X3.
Values will be entered by the user in the array.
For example:
1 2 3
4 5 6
7 8 9
Sum is : 45
Q#3: Write a c++ program to print the sum of individual row in a 2d array of size
3X3. Values will be entered by the user in the array.
For example:
1 2 3
4 5 6
7 8 9
Q#4: Write a c++ program to print the sum of individual column in a 2d array of
size 3X3. Values will be entered by the user in the array.
For example:
1 2 3
4 5 6
7 8 9
Q#5: Write a c++ program to add two 2d arrays of size 3X3. Values will be entered
by the user in the array.
For example:
First array: Second array:
1 2 3 3 2 1
4 5 6 1 4 -3
7 8 9 -6 8 7
Sum is :
4 4 4
5 9 3
1 16 16
Q#6: Write a c++ program to check if a 2d array of size 3X3 is a identity matrix.
Values will be entered by the user in the array.
Identity matrix :
1 0 0
0 1 0
0 0 1
Q#7: Write a c++ program to print transpose of a 2d array of size 3X3. Values will
be entered by the user in the array.
For example:
1 2 3
4 5 6
7 8 9
1 4 7
2 5 8
3 6 9
Q#8: Write a c++ program to print the sum of right diagonal of 2d array of size
3X3. Values will be entered by the user in the array.
For example:
1 2 3
6 1 -9
2 4 1
Q#10: Write a c++ program to find the pair having sum 12 from the given elements
(Uni-dimmensional array). Values will be entered by the user in the array.
For example:
4 3 11 7 -9 1 2 8
Output should be :
Q#11: Write a c++ program to check if the digits in a three digit number entered by
the user are consecutive,
irrespective of their order (Uni-dimmensional array). Values will be entered by the
user in the array.
For example:
If the user entered 132 or 123 or 213 or 231 or 321 or 312, the console should
prompt "They are consecutive numbers".
If the user entered 135, the console should prompt "They are not consecutive
numbers".