Page 1 of 1

(20%) Problem 4 Create a program that implements that alternates adding and subtracting numbers in a 2D array, starting

Posted: Tue Jul 12, 2022 8:05 am
by answerhappygod
20 Problem 4 Create A Program That Implements That Alternates Adding And Subtracting Numbers In A 2d Array Starting 1
20 Problem 4 Create A Program That Implements That Alternates Adding And Subtracting Numbers In A 2d Array Starting 1 (55.33 KiB) Viewed 38 times
Example run:
Enter 16 numbers: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Output: 1 + 2 - 3 + 4 - 5 + 6 - 7 + 8 - 9 + 10 - 11 + 12 - 13 + 14 - 15 + 16 = 10
Enter 16 numbers: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 aInvalid input detected.
Enter 16 numbers: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 a
Invalid input detected.
(20%) Problem 4 Create a program that implements that alternates adding and subtracting numbers in a 2D array, starting with addition. The program should accept 16 values that are placed in a 4 x 4 array. Requirements • Create a 2D int array of size 4 x 4. . Read all integers from a user. • If an invalid input is given, warn the user and exit the program gracefully (do not use exit()). • Show the full equation and result.