Array Reversal | HackerRank
Solution :
Develop by Samsus Salehin Sabbir
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #include <stdlib.h>
- int main() {
- /* Enter your code here. Read input from STDIN. Print output to STDOUT */
- int n,i,*array;
- scanf("%d",&n);
- array = (int*) malloc(n *sizeof(int));
- for(i=0;i<n;i++)
- {
- scanf("%d",array + i);
- }
- for(i=n-1;i>=0;i--)
- {
- printf("%d ",*(array+i));
- }
- printf("\n");
- return 0;
- }
No comments