Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int a[100],n,i;
- int temp;
- printf("Enter total number of even elements: ");
- scanf("%d",&n);
- for(i=0;i < n;i++)
- {
- scanf("%d",&a[i]);
- }
- for(i=0;i<n;i+=2)
- {
- temp=a[i];
- a[i]=a[i+1];
- a[i+1]=temp;
- }
- printf("Every Pair exchange \n");
- for(i=0;i<n;i++)
- {
- printf("%d\n",a[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement