Introduction
- In this blog, i am going to explain how to reverse an array.
Software Requirements
- Turbo C++ or C.
Programming
- #include < stdio.h >
- int main()
- {
- int n, c, d, a[100], b[100];
- printf("Enter the number of elements in array\n");
- scanf("%d", & n);
- printf("Enter the array elements\n");
- for (c = 0; c < n; c++) scanf("%d", & a[c]);
- for (c = n - 1, d = 0; c >= 0; c--, d++) b[d] = a[c];
- for (c = 0; c < n; c++) a[c] = b[c];
- printf("Reverse array is\n");
- for (c = 0; c < n; c++) printf("%d\n", a[c]);
- return 0;
- }
Explanation
- In the programming given above, it is easily understood that the array is reversed and the output can be printed.
Output



Ankur SohalPosted Dec 8, 2017, 1:58 AM
Very good nice try,, Can you provide me a c prog. which can find Lucky Number and color, by Input DOB
Ramesh PalaniappanPosted Aug 11, 2016, 9:24 AM
Nice Share
Anu VPosted Aug 1, 2016, 12:19 AM
Nice