Arrays Introduction

  • + 0 comments
    #include <cmath>
    #include <cstdio>
    #include <vector>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    
    
    int main() {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT */  
        int n, num;
        int temp = 0;
        cin >> n;
        int arr[n];
        do {
            cin >> num;
            arr[temp] = num;
            temp++;
        }
        while(n > temp);
        
        
        for (int i = n-1; i >= 0; i--)
        {
            cout << arr[i] << " ";
        }
        
        return 0;
    }