Post Top Ad

Monday, March 11, 2019

C++ : Display Array Element

Create an array that store 10 integer numbers (2 4 6 8 10 12 14 16 18 20). Then display those array elements on screen.






/******************************************************************************

        Create an array that store 10 integer numbers (2 4 6 8 10 12 14 16 18 20). 
        
                    Then display those array elements on a screen.
*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
   int arrayInteger[10] = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20};
   cout << "All element in array : " << endl;
   for (int i = 0; i < 10; i++) {
       cout << "Element " << i+1 << " is : " << arrayInteger[i] << endl;
   }

    return 0;

}

No comments:

Post a Comment