#include<stdio.h> #include<conio.h> void main() { int a[30],i,j,n,temp; printf("n Enter no of elements :"); scanf("%d",&n); /* read n elements in an array */ for(i=0 ; i < n ; i++) scanf("%d",&a[i]); j = i-1; // j will Point to last Element i = 0; // i will be pointing to first element while(i < j) { temp = a[i]; a[i] = a[j]; a[j] = temp; i++; // increment i and decrement j j--; } /* Print out the Result of Insertion */ for(i = 0 ;i< n ;i++) printf("n %d",a[i]); getch(); }
Next
« Prev Post
« Prev Post
Previous
Next Post »
Next Post »
Subscribe to:
Post Comments (Atom)