2. Write a C program to do the following: (20 pts, 4, 8, 8) (1) Initialize two one-dimensional integer arrays, a and b,
Posted: Mon May 09, 2022 6:18 am
Please answer ALL parts to Question 2 please. Thanks!!
2. Write a C program to do the following: (20 pts, 4, 8, 8) (1) Initialize two one-dimensional integer arrays, a and b, each of length 10. a contains {1, 2, 5, 6, 7, 2,9, 0, 2, 5), and b contains {2, 1, 3, 6, 4, 6, 8, 8). (2) Declare a one-dimensional integer array, c, of length 10. Write a loop that assign each element of c, i.e., c, as the sum of a and b. (3) Write another loop that compares each c with 8. Display the elements in c whose values are larger than 8 to console using the following sentence: "The elements in c that exceed 8 include: "......(elements)"
2. Write a C program to do the following: (20 pts, 4, 8, 8) (1) Initialize two one-dimensional integer arrays, a and b, each of length 10. a contains {1, 2, 5, 6, 7, 2,9, 0, 2, 5), and b contains {2, 1, 3, 6, 4, 6, 8, 8). (2) Declare a one-dimensional integer array, c, of length 10. Write a loop that assign each element of c, i.e., c, as the sum of a and b. (3) Write another loop that compares each c with 8. Display the elements in c whose values are larger than 8 to console using the following sentence: "The elements in c that exceed 8 include: "......(elements)"