Hackerrank C++ -------- Array Introduction

#include <iostream>
using namespace std;
  
int main(){
    int n , arr[1000] , i , j , g ;
    cin>> n ; 
     g = n  ; 
    
    for ( i = 0 ; i<n ; i++) {

        cin >> arr[i] ; 
    }

    for ( j = g-1 ; j >= 0 ; j-- ){
        cout << arr[j] << " " ; 
    } 

    return 0;
}

Comments

Popular posts from this blog

Infosys - Monster RPG GAME Sample Question Solution

Hackerrank -- C++ - Variable Sized Array Solution