Consider the following array declaration and answer questions 1 and 2: int A [5];

  1. Write the code to initialize the Array A to ALL ones (i.e., 1 in every cell using a “for” statement with declarations of any loop variables needed.
  2. Write the code to declare and initialize an integer variable sum, and follow it with the code from question 1) to sum up the values in Array A.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.