Starting from:
$30

$24

Homework 4 Solution

Files to submit: mat_add.c

Time it took Matthew to Complete: 10 mins




All programs must compile without warnings when using the -Wall and -Werror options



Submit only the files requested



Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc



Your program must match the output exactly to receive credit.



Make sure that all prompts and output match mine exactly.



Easiest way to do this is to copy and paste them



All input will be valid unless stated otherwise



Print all real numbers to two decimal places unless otherwise stated



The examples provided in the prompts do not represent all possible input you can receive.



All inputs in the examples in the prompt are underlined



You don't have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program
If you have questions please post them on Piazza



Restrictions




No global variables are allowed



Your main function may only declare variables, call other functions, and assign variables values.
Write a program called mat_add.c that asks the user for 2 matrices A, and B, and displays their sum, C.




All numbers entered will be integers
All matrices will be valid
The maximum dimension of each matrix is 100
Each row of the matrix will be entered 1 line at a time
5. The formula for calculating C[i][j] is C [i ][ j ]= A[i ][ j ]+ B [i ][ j ]

For more on how to compute the sum of two matrices see here: http://www.purplemath.com/modules/mtrxadd.htm
Examples:

Please enter the number of rows: 2
Please enter the number of columns: 2 Enter Matrix A

1 2

3 4

Enter Matrix B 100 200 200 400

A+B=

101 202

203 404

Please enter the number of rows: 2
Please enter the number of columns: 3 Enter Matrix A

10 20 -30

1 2 7

Enter Matrix B 1230 -345




A+B= 11220 -2612

More products