Arrays Introduction

Sort by

recency

|

1338 Discussions

|

  • + 0 comments

    int main() { int n; cin >> n; int list[n]; for (int i=1; i<=n; i++){ cin >> list[i - 1]; } for (int i=n; i>0;i--){ cout << list[i-1] << " "; } return 0; }

  • + 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;
    }
    
  • + 0 comments
        int n,i;
        cin>>n;
        int arr[n-1];
        
        for(i =0;i < n;i++)
        cin>>arr[i];
        
        for(n = n-1;n>=0;n--)
        cout<<arr[n]<<" ";
        return 0;
    
  • + 0 comments

    include

    include

    include

    include

    include

    using namespace std;

    int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    int a; cin>>a; int n[a]; for(int i=0; i>n[i]; } for(int i = a-1 ;i>=0;i--){ cout<

  • + 0 comments

    include

    using namespace std;

    int main() { int n; cin>>n; int arr[n]; for(int i=0;i>arr[i]; }

    for(int i=n;i>0;i--)
    {
        cout<<arr[i-1]<<" ";
    }
    
    
    
    return 0;
    

    }