Docsity

One-Dimensional Matrix Multiplication in C: A Lab Assignment, Assignments of Assembly Language Programming

Toggle sidebar
bg1
I declare that all material in this assignment is my own work except where there is
clear reference to the work of others.
I have read, understood and agree to the SDSU Policy on Plagiarism and
Cheating on the university website at
http://go.sdsu.edu/student_affairs/srr/cheating-plagiarism.aspx and the
syllabus for the consequences of plagiarism, including both academic and
punitive sanctions.
___________________________________________________________________
Remark*. By submitting this assignment report electronically, you are deemed to have signed the
declaration above.
28/2019
[Lab Assignment #6, Part 1]
[Arrays]
COMPE-160
Emrashvili Luka 823355800
pf3

Partial preview of the text

Download One-Dimensional Matrix Multiplication in C: A Lab Assignment and more Assignments Assembly Language Programming in PDF only on Docsity!

 I declare that all material in this assignment is my own work except where there is clear reference to the work of others.  I have read, understood and agree to the SDSU Policy on Plagiarism and Cheating on the university website at http://go.sdsu.edu/student_affairs/srr/cheating-plagiarism.aspx and the syllabus for the consequences of plagiarism, including both academic and punitive sanctions.


Remark*. By submitting this assignment report electronically, you are deemed to have signed the declaration above. 28/

[Lab Assignment #6, Part 1]

[Arrays]

COMPE-

Emrashvili Luka 823355800

EMRASHVILI LUKA 823355800 [LAB ASSIGNMENT #6, PART 1]

Part 1.

1. Description of the Problem / Method:

In this programming assignment, we have to do one dimensional matrix multiplication. The array size should be allocated using a #define constant and results of multiplication of first and second arrays must be placed in the third array.

2. Pseudocode:

Step 1. Allocate the size of the arrays using #define constant; Step 2. Declare an integer i and the three arrays; Step 3. Using For loop multiply the first and the second arrays and place the result to the third; Step 4. Print all three arrays, one array on each line;

3. C-code:

#define SIZE 9 int main(void) { int i; int array1[SIZE] = { 8, 2, 3, 3, 5, 5, 8, 0, 0}; int array2[SIZE] = { 1, 2, 3, 4, 5, 6, 7, 8, 9}; int array3[SIZE]; for (i = 0; i < SIZE; ++i) { array3[i] = array1[i] * array2[i]; } printf("Array1 = "); for (i = 0; i < SIZE; ++i) { printf("%d ", array1[i]); } printf("\n"); printf("Array2 = "); for (i = 0; i < SIZE; ++i) { printf("%d ", array2[i]); } printf("\n"); printf("Array3 = "); for (i = 0; i < SIZE; ++i) { printf("%d ", array3[i]); } printf("\n"); }