
Muhammad Ali Jinnah University, Islamabad Campus
Computer Programming (CS1121)
Assignment 7
Instructor: Quratulain Siddiqui
Submission Date: 1st May 2012
Marks=30
Note: Write appropriate C++ program & explain your proposed solution step by step
using comments. Your submission files must be in a folder and named by your
Registration No. e.g. EE113123-student name
1. Write a program that takes two matrixes as input of size 5X3 and 3X2. And
performs following tasks. (use menu to select options)
a. Addition
b. Multiplication
c. Subtraction
d. Sum of all possible diagonals
e. Find Largest and smallest number in both Matrixes.
2. What does the following program do? Is there any error (logical) in the
program? If yes, then what is it and how can it be corrected?
a. void main()
{ int ar_1[10][10];
int Sum=0;
for(int i=0;i<10;i++)
{
for(int j=10; j>=0; j--)
{
cin>> ar_1[j][i];
}
}
for (int i=0;i<10;i++)
{
for (int j=10; j>=0; j--)
{
Sum+=ar_1[i][j];
}
cout<<”Result- ” <<Sum;
}
}