What's New-Given Below
technicalsymposium
technicalsymposium
technicalsymposium

College Lab Codings/Project Codings-Download

DataStructure-Program for matrix operations dertminant, singular.

#include <stdio.h>
#include <conio.h>
#include <math.h>
#define MAX 3
void matrix ( int [3][3] ) ;
void create ( int [3][3] ) ;
void display ( int [3][3] ) ;
void matmul ( int [3][3], int [3][3], int [3][3] ) ;
void transpose ( int [3][3], int [3][3] ) ;
int determinant ( int [3][3] ) ;
int isortho ( int [3][3] ) ;
void main( )
{
int mat [3][3], d ;
clrscr( ) ;
printf ( "\nEnter elements for array: \n\n" ) ;
create ( mat ) ;
printf ( "\nThe Matrix: \n" ) ;
display ( mat ) ;
d = determinant ( mat ) ;
printf ( "\nThe determinant for given matrix: %d.\n", d ) ;
if ( d == 0 )
printf ( "\nMatrix is singular.\n" ) ;
else
printf ( "\nMatrix is not singular.\n" ) ;
d = isortho ( mat ) ;
if ( d != 0 )
printf ( "\nMatrix is orthogonal.\n" ) ;
else
printf ( "\nMatrix is not orthogonal.\n" ) ;
getch( ) ;
}
/* initializes the matrix mat with 0 */
void matrix ( int mat[3][3] )
{
int i, j ;
for ( i = 0 ; i < MAX ; i++ )
{
for ( j = 0 ; j < MAX ; j++ )
mat[i][j] = 0 ;
}
}
/* creates matrix mat */
void create ( int mat[3][3] )
{
int n, i, j ;
for ( i = 0 ; i < MAX ; i++ )
{
for ( j = 0 ; j < MAX ; j++ )
{
printf ( "Enter the element: " ) ;
scanf ( "%d", &n ) ;
mat[i][j] = n ;
}
}
}
/* displays the contents of matrix */
void display ( int mat[3][3] )
{
int i, j ;
for ( i = 0 ; i < MAX ; i++ )
{
for ( j = 0 ; j < MAX ; j++ )
printf ( "%d\t", mat[i][j] ) ;
printf ( "\n" ) ;
}
}
/* multiplies two matrices */
void matmul ( int mat1[3][3], int mat2[3][3], int mat3[3][3] )
{
int i, j, k ;
for ( k = 0 ; k < MAX ; k++ )
{
for ( i = 0 ; i < MAX ; i++ )
{
mat3[k][i] = 0 ;
for ( j = 0 ; j < MAX ; j++ )
mat3[k][i] += mat1[k][j] * mat2[j][i] ;
}
}
}
/* obtains transpose of matrix m1 */
void transpose ( int mat[3][3], int m[3][3] )
{
int i, j ;
for ( i = 0 ; i < MAX ; i++ )
{
for ( j = 0 ; j < MAX ; j++ )
m[i][j] = mat[j][i] ;
}
}
/* finds the determinant value for given matrix */
int determinant( int mat[3][3] )
{
int sum, i, j, k, p ;
sum = 0 ; j = 1 ; k = MAX - 1 ;
for ( i = 0 ; i < MAX ; i++ )
{
p = pow ( -1, i ) ;
if ( i == MAX - 1 )
k = 1 ;
sum = sum + ( mat[0][i] * ( mat[1][j] * mat[2][k] - mat[2][j] * mat[1][k] ) ) * p ; j = 0 ;
}
return sum ;
}
/* checks if given matrix is an orthogonal matrix */
int isortho ( int mat[3][3] )
{
/* transpose the matrix */
int m1[3][3], m2[3][3], i ;
transpose ( mat, m1 ) ;
/* multiply the matrix with its transpose */
matmul ( mat, m1, m2 ) ;
/* check for the identity matrix */
for ( i = 0 ; i < MAX ; i++ )
{
if ( m2[i][i] == 1 )
continue ;
else
break ;
}
if ( i == MAX )
return 1 ;
else
return 0 ;
}

technicalsymposium

Technicalsymposium.com-A Complete Website for Engineering Students & Engineering Faculties.All Useful Links & Contents Given Below

technicalsymposium

Free Email Alerts
Get free email alerts-Fresher’s Jobs/Conference/Symposium/Exams Alerts-Click here to Subscribe.

Free Event Publishing
Publish your college technical symposium/free events in our website & Attract more targeted audience- Click here to Get

Conference/Symposium
All engineering colleges /Premier Institutions (IIT,IISC,NIT,etc.,) Conferences/Workshop details-Click here to Get

Fresher’s Jobs/Scholarships Details
Freshers Software Jobs/Government Jobs and Student Internships/Scholarships Details- Click here to Get

Placement Papers
All Software Companies previous placement papers/Govt Competitive exam previous papers/Tech Materials free download-Click her to get.

Lab Programs/Lab Manuals
All Branches of Lab Programs/Lab Manuals for all branches of Engineering-Click here to Get

University Previous Question Papers
Anna university/All leading universities previous question papers year wise and Semester wise- Click here to Get

GATE Question Papers
GATE Previous Question Papers –All Branches by year wise-Click here to Get

Indian Engineering Services (IES) Question Papers
IES Previous Question Papers –All Branches by year wise-Click here to Get

Anna University Syllabus
Anna University all branches syllabues free download for all B.E(All Branches)/B.Tech(All Branches)/M.E/M.Tech/MCA/MBA- Click here to Get

GATE/ All Entrance Exam Syllabus
GATE/ All Leading Entrance Exam Syllabus free download-Click here to Get

Competitive Exam Syllabuses
Bank/Railway/SSC,all kind of Competitive Exam syllabuses free Download-Click here to get

Civil Engineering Lecture Notes
Civil engineering lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Electronics & Communication Engineering (ECE) Lecture Notes
Electronics & Communication Engineering (ECE) by semester wise and Lab Programs/Manuals-Click here to get

Electronics & Electronics Engineering (EEE) Lecture Notes
Electronics & Electronics Engineering (EEE) lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Mechanical Engineering (MECH) Lecture Notes
Mechanical Engineering (MECH) lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Computer Science Engineering (CSE) Lecture Notes
Computer Science Engineering (CSE) lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Information Technology Lecture Notes
Information Technology lecture notes by semester wise and Lab Programs/Manuals-Click here to get

MCA Lecture Notes
MCA lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Automobile Engineering Lecture Notes
Automobile Engineering lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Aeronautical Engineering Lecture Notes
Aeronautical Engineering lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Bio-Medical Engineering Lecture Notes
Bio-Medical Engineering lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Bio-Technology Lecture Notes
Bio-Technology lecture notes by semester wise and Lab Programs/Manuals-Click here to get

MBA Lecture Notes
MBA lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Hosting by Yahoo!

About-Us    Contact-Us    Site-map

©copyright 2009 All rights are reserved to technicalsymposium.com