/*Program to interchange array elements*/
#include<stdio.h>
void main() {
int A[10] = { 21, 3, 61, 80, 9, 73, 0, 5, 1, 2 }, i, B[10];
for (i = 0; i < 10; i += 2) {
B[i] = A[i + 1];
B[i + 1] = A[i];
}
printf("\nOriginal array is: ");
for (i = 0; i < 10; i++)
printf("%d ", A[i]);
printf("\nInterchanged array is: ");
for (i = 0; i < 10; i++)
printf("%d ", B[i]);
}
WHAT'S NEW?
Loading...
0 comments:
Post a Comment