DS:Lab-1 Prepared by: Shipra Shukla Assistant Professor Kaziranga University.

Slides:



Advertisements
Similar presentations
2.3 Modeling Real World Data with Matrices
Advertisements

Singly Linked List BTECH, EE KAZIRANGA UNIVERSITY.
For(int i = 1; i
Recursion Prog #include <stdio.h> #include<conio.h> main()
1 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d",
BNF <digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Data Structure Lecture-5
Data Structure Lecture-3 Prepared by: Shipra Shukla Assistant Professor Kaziranga University.
Section 13-4: Matrix Multiplication
Chapter 2 Section 2. Lemma Let i=1 and j=2, then.
What is shape function ? shape function is a function that will give the displacements inside an element if its displacement at all the node locations.
Test practice Multiplication. Multiplication 9x2.
Sort the given string, without using string handling functions.
Solution April 13, #include int main( void ) { int salaries[ 11 ] = { 0 }; /*total salary */ int sales; /* sales per karyawan */ double salary;
Matrix Multiplication To Multiply matrix A by matrix B: Multiply corresponding entries and then add the resulting products (1)(-1)+ (2)(3) Multiply each.
Maths for Computer Graphics
ENGR 3 rocks. Your friendly TA Damon Good list of VI commands Good online free guide to Linux (time-sucker)
Table of Contents Matrices - Multiplication Assume that matrix A is of order m  n and matrix B is of order p  q. To determine whether or not A can be.
Section 7.2 & 7.3.  Row x Column ROW COLUMN a x + b y = c d x + e y = f AB X.
Algebra 3: Section 5.5 Objectives of this Section Find the Sum and Difference of Two Matrices Find Scalar Multiples of a Matrix Find the Product of Two.
Balancing a trip matrix. sumAiOi 21361, , ,
Data Structure CS 322. What is an array? Initializing arrays Accessing the values of an array Multidimensional arrays LAB#1 : Arrays.
10.3 Systems of Linear Equations: Matrices. A matrix is defined as a rectangular array of numbers, Column 1Column 2 Column jColumn n Row 1 Row 2 Row 3.
8.2 Operations With Matrices
Warm Up Perform the indicated operations. If the matrix does not exist, write impossible
What is Matrix Multiplication? Matrix multiplication is the process of multiplying two matrices together to get another matrix. It differs from scalar.
Matrix Multiplication The Introduction. Look at the matrix sizes.
Matrix Multiplication. Row 1 x Column X 25 = Jeff Bivin -- LZHS.
3.6 Multiplying Matrices Homework 3-17odd and odd.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
= the matrix for T relative to the standard basis is a basis for R 2. B is the matrix for T relative to To find B, complete:
What does this say? Matrix Multiplication ! What does this say?
Notes Over 4.2 Finding the Product of Two Matrices Find the product. If it is not defined, state the reason. To multiply matrices, the number of columns.
4-3 Matrix Multiplication Objective: To multiply a matrix by a scalar multiple.
EXAMPLE. Dr. Soha S. Zaghloul2 Write a complete program that searches for all the elements that are multiple of 7 in array X of type int and size 100.
© 207 M. Tallman. © 2007 M. Tallman Array- objects or symbols displayed in rows and columns. 3 Rows 4 Columns of 4 of 3.
MATRICES MATRIX Multiplication. Warm-up Subtract (don’t forget to KCC):
Matrix Multiplication Example 1 Original author: Jeffrey Bivin, Lake Zurich High School.
$200 $400 $600 $800 $1000 $200 $400 $600 $800 $1000 $200 $400 $600 $800 $1000 $200 $400 $600 $800 $1000 $200 $400 $600 $800 $1000 $200.
2.1 Matrix Operations 2. Matrix Algebra. j -th column i -th row Diagonal entries Diagonal matrix : a square matrix whose nondiagonal entries are zero.
Chapter 5: Preparing C Programs
12-1 Organizing Data Using Matrices
Dynamic Array Multidimensional Array Matric Operation with Array
Matrix Multiplication
Matrix Multiplication
Matrix Operations SpringSemester 2017.
CS1100 Computational Engineering
Multiplying Matrices.
Section 3.1 – Operations with Matrices
2. Matrix Algebra 2.1 Matrix Operations.
Matrix Multiplication
Objectives Multiply two matrices.
Multidimensional array
Multiplying Matrices.
ECE 103 Engineering Programming Chapter 19 Nested Loops
Matrix Addition
Matrix Multiplication
Multiplication of Matrices
3.6 Multiply Matrices.
Matrix Operations SpringSemester 2017.
Matrix A matrix is a rectangular arrangement of numbers in rows and columns Each number in a matrix is called an Element. The dimensions of a matrix are.
Multiplying Matrices.
Multiplying Matrices.
Matrix Multiplication Sec. 4.2
Introduction to Matrices
Multiplying Matrices.
Range check 範圍檢查: int age; int score; int month; 1-12
L4-5/L4-6 Objective: Students will be able to evaluate determinants of matrices.
Chapter 6 - Arrays Outline Multiple-Subscripted Arrays.
Presentation transcript:

DS:Lab-1 Prepared by: Shipra Shukla Assistant Professor Kaziranga University

Matrix Multiplication

#include int main(){ int a[5][5],b[5][5],c[5][5],i,j,k,sum=0,m,n,o,p; printf("\nEnter the row and column of first matrix"); scanf("%d %d",&m,&n); printf("\nEnter the row and column of second matrix"); scanf("%d %d",&o,&p); if(n!=o){ printf("Matrix mutiplication is not possible"); printf("\nColumn of first matrix must be same as row of second matrix"); } else{ printf("\nEnter the First matrix->"); for(i=0;i<m;i++) for(j=0;j<n;j++) scanf("%d",&a[i][j]); printf("\nEnter the Second matrix->"); for(i=0;i<o;i++) for(j=0;j<p;j++) scanf("%d",&b[i][j]);

printf("\nThe First matrix is\n"); for(i=0;i<m;i++){ printf("\n"); for(j=0;j<n;j++){ printf("%d\t",a[i][j]); } printf("\nThe Second matrix is\n"); for(i=0;i<o;i++){ printf("\n"); for(j=0;j<p;j++){ printf("%d\t",b[i][j]); }

for(i=0;i<m;i++) for(j=0;j<p;j++) c[i][j]=0; for(i=0;i<m;i++){ //row of first matrix for(j=0;j<p;j++){ //column of second matrix sum=0; for(k=0;k<n;k++) sum=sum+a[i][k]*b[k][j]; c[i][j]=sum; } printf("\nThe multiplication of two matrix is\n"); for(i=0;i<m;i++){ printf("\n"); for(j=0;j<p;j++){ printf("%d\t",c[i][j]); } getch(); }