Assign

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Assign as PDF for free.

More details

  • Words: 1,307
  • Pages: 8
USE SEPARATE FUNCTIONS FOR EACH MATRIX OPERATION Write a C Language code to make following output ********************* Instructions: ********************* Please enter the choice against which matrix operation you want to apply. Enter “1” to perform matrix addition Enter “2” to perform matrix subtraction. Enter “3” to perform matrix Multiplication. Enter “4” to perform scalar matrix Multiplication. Enter “5” to perform matrix Inversion. Enter “6” to find determinant of matrix. Enter “7” to find transpose of a matrix. Enter “E” to Exit from program. Please Enter your choice: 1 Enter First 3x3 matrix for addition Element at 1x1: 1 Element at 1x2: 0 Element at 1x3: 0 Element at 2x1: 0 Element at 2x2: 1 Element at 2x3: 0 Element at 3x1: 0 Element at 3x2: 0 Element at 3x3: 1 1 0 0

0 1 0

0 0 1

1 0 1

1 1 0

1 1 1

1 1 1

+ 0 1 1 = 1 1 1

********************* Instructions: ********************* Please enter the choice against which matrix operation you want to apply. Enter “1” to perform matrix addition Enter “2” to perform matrix subtraction. Enter “3” to perform matrix Multiplication. Enter “4” to perform scalar matrix Multiplication. Enter “5” to perform matrix Inversion. Enter “6” to find determinant of matrix. Enter “7” to find transpose of a matrix. Enter “E” to Exit from program. Please Enter your choice: 2 Enter First 3x3 matrix for Subtraction Element at 1x1: 1 Element at 1x2: 0 Element at 1x3: 0 Element at 2x1: 0 Element at 2x2: 1 Element at 2x3: 0 Element at 3x1: 0 Element at 3x2: 0 Element at 3x3: 1 Enter Second 3x3 matrix for Subtraction Element at 1x1: 0 Element at 1x2: 1 Element at 1x3: 1 Element at 2x1: 1 Element at 2x2: 0 Element at 2x3: 1 Element at 3x1: 1 Element at 3x2: 1 Element at 3x3: 0 1 0 0 0 1 0 0 0 1 0 1 1 =

1 0 1

1 1 0

1 -1 1 -1 1 -1 -1 -1 1 ********************* Instructions: ********************* Please enter the choice against which matrix operation you want to apply. Enter “1” to perform matrix addition Enter “2” to perform matrix subtraction. Enter “3” to perform matrix Multiplication. Enter “4” to perform scalar matrix Multiplication. Enter “5” to perform matrix Inversion. Enter “6” to find determinant of matrix. Enter “7” to find transpose of a matrix. Enter “E” to Exit from program. Please Enter your choice: 3 Enter First 3x3 matrix for Multiplication Element at 1x1: 1 Element at 1x2: 0 Element at 1x3: 0 Element at 2x1: 0 Element at 2x2: 1 Element at 2x3: 0 Element at 3x1: 0 Element at 3x2: 0 Element at 3x3: 1 Enter Second 3x3 matrix for Multiplication Element at 1x1: 0 Element at 1x2: 1 Element at 1x3: 1 Element at 2x1: 1 Element at 2x2: 0 Element at 2x3: 1 Element at 3x1: 1 Element at 3x2: 1 Element at 3x3: 0 1 0 0 0 1 0 0 0 1 x

0 1 1

1 0 1

1 1 0

= 0 1 1 1 0 1 1 1 0 ********************* Instructions: ********************* Please enter the choice against which matrix operation you want to apply. Enter “1” to perform matrix addition Enter “2” to perform matrix subtraction. Enter “3” to perform matrix Multiplication. Enter “4” to perform scalar matrix Multiplication. Enter “5” to perform matrix Inversion. Enter “6” to find determinant of matrix. Enter “7” to find transpose of a matrix. Enter “E” to Exit from program. Please Enter your choice: 4 Enter the scalar number by which matrix is to by multiplied: 7 Enter 3x3 matrix for Scalar Multiplication by 7: Element at 1x1: 1 Element at 1x2: 0 Element at 1x3: 0 Element at 2x1: 0 Element at 2x2: 1 Element at 2x3: 0 Element at 3x1: 0 Element at 3x2: 0 Element at 3x3: 1 7 x

1 0 0

0 1 0

0 0 1

7 0 0

0 7 0

0 0 7

=

********************* Instructions: ********************* Please enter the choice against which matrix operation you want to apply. Enter “1” to perform matrix addition Enter “2” to perform matrix subtraction. Enter “3” to perform matrix Multiplication. Enter “4” to perform scalar matrix Multiplication. Enter “5” to perform matrix Inversion. Enter “6” to find determinant of matrix. Enter “7” to find transpose of a matrix. Enter “E” to Exit from program. Please Enter your choice: 5 Enter 3x3 matrix which is to be inverted: Element at 1x1: 1 Element at 1x2: 0 Element at 1x3: 0 Element at 2x1: 0 Element at 2x2: 1 Element at 2x3: 0 Element at 3x1: 0 Element at 3x2: 0 Element at 3x3: 1 -1 1 0 0

0 1 0

0 0 1

1 0 0

0 1 0

0 0 1

=

********************* Instructions: ********************* Please enter the choice against which matrix operation you want to apply. Enter “1” to perform matrix addition Enter “2” to perform matrix subtraction. Enter “3” to perform matrix Multiplication. Enter “4” to perform scalar matrix Multiplication. Enter “5” to perform matrix Inversion.

Enter “6” to find determinant of matrix. Enter “7” to find transpose of a matrix. Enter “E” to Exit from program. ********************* Instructions: ********************* Please enter the choice against which matrix operation you want to apply. Enter “1” to perform matrix addition Enter “2” to perform matrix subtraction. Enter “3” to perform matrix Multiplication. Enter “4” to perform scalar matrix Multiplication. Enter “5” to perform matrix Inversion. Enter “6” to find determinant of matrix. Enter “7” to find transpose of a matrix. Enter “E” to Exit from program. Please Enter your choice: 6 Enter 3x3 matrix whose determinant is to be found: Element at 1x1: 1 Element at 1x2: 0 Element at 1x3: 0 Element at 2x1: 0 Element at 2x2: 1 Element at 2x3: 0 Element at 3x1: 0 Element at 3x2: 0 Element at 3x3: 1 1 det of 0 0

0 1 0

0 0 1

=1 ********************* Instructions: ********************* Please enter the choice against which matrix operation you want to apply. Enter “1” to perform matrix addition Enter “2” to perform matrix subtraction. Enter “3” to perform matrix Multiplication. Enter “4” to perform scalar matrix Multiplication. Enter “5” to perform matrix Inversion. Enter “6” to find determinant of matrix. Enter “7” to find transpose of a matrix.

Enter “E” to Exit from program. Please Enter your choice: 7 Enter 3x3 matrix which is to be inverted: Element at 1x1: 1 Element at 1x2: 0 Element at 1x3: 0 Element at 2x1: 0 Element at 2x2: 1 Element at 2x3: 0 Element at 3x1: 0 Element at 3x2: 0 Element at 3x3: 1 t 1 0 0

0 1 0

0 0 1

1 0 0

0 1 0

0 0 1

=

********************* Instructions: ********************* Please enter the choice against which matrix operation you want to apply. Enter “1” to perform matrix addition Enter “2” to perform matrix subtraction. Enter “3” to perform matrix Multiplication. Enter “4” to perform scalar matrix Multiplication. Enter “5” to perform matrix Inversion. Enter “6” to find determinant of matrix. Enter “7” to find transpose of a matrix. Enter “E” to Exit from program. Please Enter your choice: 8 WARNING: WRONG OPERATION CODE!! PLEASE READ INSTRUCTIONS CAREFULLY AND ENTER THE CORRESPONDING CODE. ********************* Instructions:

********************* Please enter the choice against which matrix operation you want to apply. Enter “1” to perform matrix addition Enter “2” to perform matrix subtraction. Enter “3” to perform matrix Multiplication. Enter “4” to perform scalar matrix Multiplication. Enter “5” to perform matrix Inversion. Enter “6” to find determinant of matrix. Enter “7” to find transpose of a matrix. Enter “E” to Exit from program. Please Enter your choice: E Thanyou for Using MATRIX CALCULATOR.

Related Documents

Assign
May 2020 59
Assign
June 2020 55
Assign
May 2020 57
Assign
November 2019 79
Assign
November 2019 91
Assign)
June 2020 57