Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int a[10], i,t;
- for (i = 0; i<10; i++)
- a[i] = rand()%10;
- for (i = 0; i<10; i++)
- printf("%d ",a[i]);
- printf("\n");
- for (i = 0; i+1<10; i+=2)
- {
- t = a[i];
- a[i] = a[i+1];
- a[i+1] = t;
- }
- for (i = 0; i<10; i++)
- printf("%d ",a[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement