Advertisement
Dido09

Reversed Array - C

Mar 28th, 2022
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #define MAX_SIZE 100
  3.  
  4. int main(){
  5.  
  6. int arr[MAX_SIZE];
  7. int size, i;
  8.  
  9.  
  10. printf("Enter the size of the array: ");
  11. scanf("%d", &size);
  12.  
  13. printf("\nEnter elements in the array: ");
  14. for(i = 0; i < size; i++){
  15. scanf("%d", &arr[i]);
  16. }
  17.  
  18. printf("\nReversed Array: ");
  19. for(i = size - 1; i >= 0; i--){
  20. printf("%d\t", arr[i]);
  21. }
  22.  
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement