Answer to Question #337823 in C++ for 1.111 array

Question #337823

An array containing 5 integer elements is already provided for you in the code editor below.


Print out the cube of the 1st, 3rd, and 5th element of the given array.


Output



Multiple lines containing the cubes of the 3 elements of the given array.



-8


1


27

1
Expert's answer
2022-05-05T16:26:12-0400
#include <iostream>
 
using namespace std;

int main() {
   
  int arr[5] ={-2, 6, 1, 3, 3};
 
  for(int i = 0; i <5; i+=2) {
    cout<< arr[i]*arr[i] * arr[i]<< endl;
    }

  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS