Question
programming in c Restrictions No global variables may be used Your main function may only declare variables and call other functions New: No statically defined
programming in c
Restrictions
- No global variables may be used
- Your main function may only declare variables and call other functions
- New: No statically defined arrays may be declared
- There are the ones that look like: int ar[10];
Description
Write a program that adds two matrices together. If you don't know how matrix addition works you can see this website for details: http://www.purplemath.com/modules/mtrxadd.htm
Details
- The user will enter input in the following order
- The number of rows
- The number of columns
- The values of matrix A
- The values of matrix B
- There is no maximum size for the matrix
- The matrices will not always be square (have the same number of rows and columns)
- The matrix will be entered one line at a time
Assumptions
- Input WILL always be valid
- The values in the matrices will be integers
Examples
User input is underlined to help you differentiate between user input and the program output. You do not have to underline anything.
Example 1
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
Example 2
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 1 2 30 -3 4 5 A + B = 11 22 0 -2 6 12
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started