You are on page 1of 42

INDEX

1. Certificate
2. Acknowledgement
3. Preface
4. Introduction To Problem Area
5. Limitation of Manual System
6. Proposed System
7. System Design
a. Output
b. Input
c. File Design
8. Code
9. Output & Reports
9. Limitation of Project
10. Further Scope
11. References
ACKNOWLEDGEMENT

First of all, I would like to thank the

supreme power, the almighty GOD who has

always guided us to work on the right path

of our life. Without his grace this project

could not become a reality. Secondly, my

parents who have always inspired and

encouraged me through my life.

I feel obliged in taking the opportunity to

thanks (Principal) and my worthy thanks

to Mr. Amit Goel (HOD of computer

Application ) and Ms. Shilpa Garg, Lecturer

(Computer Application).
Project is like a bridge between

theoretical and practical working. With

this willing I joined this particular project.

It’s a matter of great pleasure for me to

submit a project report on “MATRIX

MANIPULATION ”.

I would like to express my gratitude

towards all those who helped me to nurse

this project from the idea stage to finished

product in your hands. Though only my

name appears on the cover but credit for

this project belongs to my Teachers.


(Arti Rani)

PREFACE
In ever widening modern world, the present
system of education is facing new challenges.
It is well known fact that today is the age of
computers. There are so many major
achievements in science & technology fields.
Now a days every one is realizing the
importance of computer which is the
achievement of modern age in fifth generation
of computers.

In the modern era of science & technology as a


powerful nation, India is still lagging behind
dueto disadvancement in computer technologies.
This problem can be over come only when the
youth of India of the present generation give
full co-operation in rising India as a
powerful nation by learning more and more
computers.
So, realizing this fact and according to time
demand when computers are necessary and
important achievement, I have chosen this
professional course from Maharaja Agrasen
College,Jagadhri affiliated to KURUKSHETRA
UNIVERSITY, KURUKSHETRA.
INTRODUCTION TO PROBLEM AREA

Mathematics is a group of rules, theorems and


basic laws who work together to achieve
specified result. A Matrix Manipulation
contains many & more concepts.

In existing system or we can say that when


work is being done manually, this system
involves a lot of paper work. Because if there
is large strength of matrices to Maintain,
then Person cannot remember each & every
value of different Matrices.

Now industries are running at rocket speed.


There is competition in each & every field.
For large strength of Matrices it is very
complicated to keep the records manually.

With manual system, entries for Matrix


information, their manipulation performed in
different files.
Therefore, a lot of time is consumed to
perform this work. Data stored in files can
not be maintained for long period of time and
a lot of time is to be consumed in find a
particular entry. In that system, the chances
of inaccuracy and duplicacy will be more.
LIMITATIONS OF MANUAL SYSTEM

1. Large order matrices cannot be handled


properly.

2. In a manual system huge paper work is


required. We can not maintain its record &
preserve it for long period.

3. The Order of matrices cannot be modified.

4. In a manual system, some time mistakes creep


in and results are not correct which leads to
falsification.

So, in the present era, world is moving on a


fast track and manual system can not complete
the requirements of its users, with the changing
world progress.
PROPOSED SYSTEM

In modern mathematics, matrices occupy a very


important place. So, the working knowledge of is
must as the problems occurring in science,
engineering and applied mathematics can be
efficiently solved by expressing them in the form
of matrices. They provide an algebraic structure
slightly different from that of the real number.
They are widely used in modern algebra, applied
mathematics, atomic physics, mathematical problem
of economics etc.

A matrix is a system of m, n elements arranged in a


rectangular formation along m rows and n columns
bounded by brackets []. This formation is sometimes
more explicitly known as m by n matrix and written
as mn matrix. Each of the numbers is called element
of the matrix. A matrix is always denoted by a
single capital letter.

There are various operations which can be performed


on a matrix. So, I have developed a software which
performs some of the widely used operations
implemented on a matrix. This system includes the
following operations:-
 Addition of matrices:- If A and B are two
matrices of the same order ,then their sum A+B is
defined as the matrix whose elements is the sum of
the corresponding elements of A and B.
 Subtraction of two matrices:-If A and B
are the two matrices of the same order the A-B is
defined as the matrix whose elements is obtained by
subtracting the corresponding elements of B and A.
 Multiplication of two matrices:-
Multiplication of two matrices is possible only if
the number of columns of the first matrix is equal
to the number of rows of the second matrix. Such
matrices are known as Conformable matrices.
 Transpose of a matrix:-The matrix obtained
from any matrix A by interchanging its rows and
columns is called the transpose matrix of A.
 Inverse of a matrix:-The inverse of a
square matrix A is denoted by Aˉ¹, which exits only
if A.Aˉ¹=I, where I is the identity or unity
matrix.
 Maximum element of a matrix:-The maximum
operation is used to calculate out the element
having the maximum element in the matrix.
 Minimum element of a matrix:-The minimum
operation is used to calculate out the element
having the minimum element in the matrix.
 Mean of the matrix:-Mean of the matrix is
calculated out by performing the sum of all the
elements divided by the total number of the
elements.
There is a facility of matrix manipulation menu in
which there is a list of operations the user want
to perform.

There is a facility for the user to enter the size


of the matrix i.e. the rows and columns of the
matrix.

In between there is a function for validation.


Lastly, you can exit from program using the quit
operation.
ADVANTAGES OF THE PROJECT
Since matrix is widely used concept in mathematics
as well as in computer data structure. Also it is
used in many logic building. So, we have developed a
program that provide ease in the manipulation of
matrix. Advantages of project are:
 The matrix size i.e. the rows and the column of
variable size can be inputted up to the size of
five.
 In the multiplication operation ,the program
automatically assigns the column of first matrix
equal to the rows of second matrix which is the
essential condition to multiply two matrices.
 The program only takes the integer value. If
attempt to input some other type aside from integer
is performed then it will not take that value and
wait until an integer value is entered.
 If the user by mistake input press enter before
entering any value then it is automatically assigned
with zero so that program do not take any default
value.
 The user can see the input and output on the
same screen and can verify the answer.
LIMITATIONS OF PROJECT

 This system will not provide the right results


in the event of wrong input data.

 This system prepared with limited resources and


information at our disposal, It may not last long beyond
a certain period.

 One cannot provide input of matrices greater


than five.
 It does not provide the printable facility to
the candidate.
 The mouse pointer is not implemented.
FURTHER SCOPE

The main advantage and future scope would be the


fastest execution of this program due to the reason
that of developing in C language.

The program can be further modified so that it can


input the matrices of the size greater than five.
Also the mouse can be implemented so as to choose
the options through the mouse.

Graphics can be included so as to make the concept


of matrix more clearer. More operations related to
matrix that are widely in use can be also
implemented to increase the application area of
this software.
REFERENCES

1) Yashwant Kanetkar Let us C(BPB)

2)Balagurusami Programming in C

3)R.S.Salaria Numerical Methods(BPB)


SYSTEM DESIGN

1. OUTPUT

2. INPUT

3. FILE DESIGN
Output

1. Matrix addition:- This module is used to make

addition of matrices of different different order

matrices

2. Matrix Subtraction:- This module is used to make

subtraction of matrices of different different order

matrices

3. Matrix Multiplication:- This module is used to make

Multiplication of matrices of different different order

matrices

4. Matrix Transpose:- This module is used to make

addition of matrices of different different order

matrices
5. Matrix Maximum- This module is used to find out the

maximum element of different different order matrices

6. Matrix Minimum:- This module is used to find out

minimum element of different different order matrices

7. Matrix Diagonal Sum:- This module is used to find

out the sum of diagonal elements of different different

order matrices
INPUT
N * M MATRIX

In all the cases we have to input a


particular order matrix like 3 * 3
matrix.

A B

1 2 3 4 5 6

4 5 6 7 8 9
7 8 9 1 2 3
File Design

Basically my project is used for matrices

manipulations. We are having different

different order matrices. We can enter any

order matrix like 3 * 3, 2 * 2 etc.

We have to input the n number of elements.

Coding
/* MATRIX MANIPULATION PACKAGE */
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
int a[10][10],b[10][10],d[10][10];
int c,r,i,m,n,j,k,min,max,sum;
/* Blinking */
void blink()
{
int polyarray[]={100,100,550,100,550,400,100,400};
int gd=DETECT,gm;
initgraph(&gd,&gm," ");
setcolor(BROWN);
setlinestyle(0,0,3);
fillpoly(4,polyarray);
setcolor(RED);
settextstyle(10,0,2);
outtextxy(220,200,"MATRIX MANIPULATION");

while(!kbhit())
{
static int x;
setfillstyle(SOLID_FILL,x);
floodfill(320,240,BROWN);
setcolor(BLACK);
outtextxy(220,200,"MATRIX MANIPULATION");
delay(900);
setfillstyle(SOLID_FILL,x);
floodfill(320,240,BROWN);
setcolor(WHITE);
outtextxy(220,200,"MATRIX MANIPULATION");
delay(900);
}
getch();
closegraph();
}
/* Front Page of Project */
void front(){
int gd=DETECT,gm;
initgraph(&gd,&gm," ");
setfillstyle(SOLID_FILL,12);
bar(0,0,640,480);
setcolor(1);
setlinestyle(2,0,3);
line(30,120,620,120);
line(30,120,30,270);
line(30,270,620,270);
line(620,270,620,120);
setcolor(14);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,7);
outtextxy(65,150,"MATRIX PACKAGE");
setfillstyle(SOLID_FILL,3);
bar(100,420,500,440);
settextstyle(SMALL_FONT,HORIZ_DIR,5);
setcolor(1);
outtextxy(150,423,"Welcome To Matrix Manipulation Project");
getch();
closegraph();}
/* Screen Designing */
void screen(const char *ch){
c=28;r=1;
gotoxy(c,r);
for(i=1;i<=25;i++){
printf("*");}
r++;
for(i=1;i<=2;i++){
gotoxy(c,r);
printf("*");
r++;}
r--;
c++;
gotoxy(c,r);
for(i=1;i<=24;i++){
printf("*");}
c=52;
r--;
for(i=1;i<=1;i++){
gotoxy(c,r);
printf("*");
r--;}
c=32;
r=2;
gotoxy(c,r);
printf("%s",ch);
c=16;
r=4;
gotoxy(c,r);
for(i=1;i<=44;i++){
printf("*");}
r=r+1;
for(i=1;i<=19;i++){
gotoxy(c,r);
printf("*");
r=r+1;}
c=c+1;
gotoxy(c,--r);
for(i=1;i<=43;i++){
printf("*");}
r=r-1;
c=59;
for(i=1;i<=18;i++){
gotoxy(c,r);
printf("*");}
/* Main Menu */
void menu(){
c=22;
r=6;
gotoxy(c,r);
printf("1.Addition");
gotoxy(c,r=r+2);
printf("2.Subtraction");
gotoxy(c,r=r+2);
printf("3.Multiplication");
gotoxy(c,r=r+2);
printf("4.Transpose");
gotoxy(c,r=r+2);
printf("5.Minimum");
gotoxy(c,r=r+2);
printf("6.Maximum");
gotoxy(c,r=r+2);
printf("7.Diagonal's Sum");
gotoxy(c,r=r+2);
printf("8.Exit");
}
/* Matrix Input */
void mat_input(){
printf("How Many Rows in The First Matrix ");
scanf("%d",&m);
printf("\n");
printf("How Many Columns in The First Matrix ");
scanf("%d",&n);
printf("\n");
printf("Enter the %d * %d Matrix Elements\n\n",m,n);
for(i=0;i<m;i++){
for(j=0;j<n;j++){
scanf("%d",&a[i][j]);}}
printf("\n");
printf("How Many Rows in The Second Matrix ");
scanf("%d",&m);
printf("\n");
printf("How Many Columns in The Second Matrix ");
scanf("%d",&n);
printf("\n");
printf("Enter the %d * %d Matrix Elements\n\n",m,n);
for(i=0;i<m;i++){
for(j=0;j<n;j++){
scanf("%d",&b[i][j]);}}}
/* Matrix Display */
void mat_display(){
clrscr();
printf("The First Matrix is:-\n\n");
for(i=0;i<m;i++){
for(j=0;j<n;j++){
printf("%d\t",a[i][j]);}
printf("\n");}
printf("\nThe Second Matrix is:-\n\n");
for(i=0;i<m;i++){
for(j=0;j<n;j++){
printf("%d\t",b[i][j]);}
printf("\n");}}
/* Matrix Addition */
void mat_add(){
printf("\nThe Matrix Addition is:-\n\n");
for(i=0;i<m;i++){
for(j=0;j<n;j++){
d[i][j]=a[i][j]+b[i][j];
printf("%d\t",d[i][j]);}
printf("\n");}}
/* Matrix Subtraction */
void mat_sub(){
printf("\nThe Matrix Subtraction is:-\n\n");
for(i=0;i<m;i++){
for(j=0;j<n;j++){
d[i][j]=a[i][j]-b[i][j];
printf("%d\t",d[i][j]);}
printf("\n");}}
/* Matrix Multiplication */
void mat_mul(){
for(i=0;i<m;i++){
for(j=0;j<n;j++){
d[i][j]=0;
for(k=0;k<n;k++){
d[i][j]=d[i][j]+a[i][k]*b[k][j];}}}
printf("\nThe Matrix Multiplication is:-\n\n");
for(i=0;i<m;i++){
for(j=0;j<n;j++){
printf("%d\t",d[i][j]);}
printf("\n");}}
/* Matrix Input */
void mat_input1(){
printf("How Many Rows in The Matrix ");
scanf("%d",&m);
printf("\n");
printf("How Many Columns in The Matrix ");
scanf("%d",&n);
printf("\n");
printf("Enter the %d * %d Matrix Elements\n\n",m,n);
for(i=0;i<m;i++){
for(j=0;j<n;j++){
scanf("%d",&a[i][j]);}}}
/* Matrix Display */
void mat_display1(){
clrscr();
printf("The Original Matrix is :-\n\n");
for(i=0;i<m;i++){
for(j=0;j<n;j++){
printf("%d\t",a[i][j]);}
printf("\n");}}
/* Matrix Transpose */
void mat_trans(){
printf("\nThe Matrix Transpose is :-\n\n");
for(i=0;i<m;i++){
for(j=0;j<n;j++){
printf("%d\t",a[j][i]);}
printf("\n");}}
/* Matrix Minimum */
void mat_minimum(){
min=a[0][0];
for(i=0;i<m;i++){
for(j=0;j<n;j++){
if(a[i][j]<min){
min=a[i][j];}}}
printf("\n");
printf("The Minimum Element in The Matrix is ->\t%d",min);}
/* Matrix Maximum */
void mat_maximum(){
max=a[0][0];
for(i=0;i<m;i++){
for(j=0;j<n;j++){
if(a[i][j]>max){
max=a[i][j];}}}
printf("\n");
printf("The Minimum Element in The Matrix is ->\t%d",max);}
/* Matrix Diagonal Sum */
void mat_diaognal(){
sum=0;
for(i=0;i<m;i++){
for(j=0;j<n;j++){
if(i==j){
sum=sum+a[i][j];}}}
printf("\n");
printf("The Sum Of Diaognal Element is ->\t%d",sum);}
/* Back Page */
void back()
{
int gd=DETECT,gm;
initgraph(&gd,&gm," ");
setfillstyle(SOLID_FILL,LIGHTGRAY);
bar(0,0,640,480);
setcolor(RED);
setlinestyle(0,0,3);
line(0,120,640,120);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,6);
outtextxy(135,130,"Thanks@@@");
outtextxy(10,190,"For Using This Project!!!");
line(0,270,640,270);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
outtextxy(455,290,"DEVELOPED BY:-");
settextstyle(TRIPLEX_FONT,HORIZ_DIR,2);
outtextxy(455,320,"NAME:- SOURABH");
outtextxy(455,355,"CLASS:-B.COM II");
outtextxy(455,385,"ROLL NO:-");
setfillstyle(SOLID_FILL,BLUE);
bar(100,420,500,440);
settextstyle(SMALL_FONT,HORIZ_DIR,5);
outtextxy(150,423,"YOURS COMMENTS ARE ALWAYS
WELCOME");
getch();
closegraph();
}
/* Main Program Begins */
main(){
int ch;
char ans;
clrscr();
blink();
getch();
front();
abc:
clrscr();
screen("MATRIX PACKAGE");
menu();
gotoxy(c,r=r+2);
printf("\tEnter Your Choice ");
scanf("%d",&ch);
switch(ch){
case 1:
clrscr();
mat_input();
mat_display();
mat_add();
printf("\n\n\nPress Any Key to Return to Main Menu...");
getch();
goto abc;
break;
case 2:
clrscr();
mat_input();
mat_display();
mat_sub();
printf("\n\n\nPress Any Key to Return to Main Menu...");
getch();
goto abc;
break;
case 3:
clrscr();
mat_input();
mat_display();
mat_mul();
printf("\n\n\nPress Any Key to Return to Main Menu...");
getch();
goto abc;
break;
case 4:
clrscr();
mat_input1();
mat_display1();
mat_trans();
printf("\n\n\nPress Any Key to Return to Main Menu...");
getch();
goto abc;
break;
case 5:
clrscr();
mat_input1();
mat_display1();
mat_minimum();
printf("\n\n\nPress Any Key to Return to Main Menu...");
getch();
goto abc;
break;
case 6:
clrscr();
mat_input1();
mat_display1();
mat_maximum();
printf("\n\n\nPress Any Key to Return to Main Menu...");
getch();
goto abc;
break;
case 7:
clrscr();
mat_input1();
mat_display1();
mat_diaognal();
printf("\n\n\nPress Any Key to Return to Main Menu...");
getch();
goto abc;
break;
case 8:
clrscr();
gotoxy(10,5);
fflush(stdin);
printf("Really Do You Want To Exit (Y/N):-\t");
scanf("%c",&ans);
if(ans=='y' || ans=='Y'){
printf("\n\n\n");
printf("\t");
textcolor(10+128);
cprintf("Thanks For Using This Project!!!!");
getch();
exit(1);}
else
goto abc;
break;
default:
printf("Please Enter between 1 to 9 only");
back();
}
getch();}

You might also like