Arrays Solution in C Programming

This Page Contains the Solution in C Programming Language for the Day 7 : Arrays, Code Challange of the HackerRank 30 Days of Code.

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
    int n,m=0; 
    scanf("%d",&n);
    int *arr = malloc(sizeof(int) * n);
    for(int arr_i = 0; arr_i < n; arr_i++){
       scanf("%d",&arr[arr_i]);
    }
    for(int arr_j=n-1;arr_j >=0; arr_j--){
        printf("%d ", arr[arr_j]);
    }
    return 0;
}

Last updated

Was this helpful?