

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


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/
[Arrays]
EMRASHVILI LUKA 823355800 [LAB ASSIGNMENT #6, PART 1]
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.
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;
#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"); }