Write a c program for swapping of two arrays
Solution :
#include<stdio.h>
int main(){
int a[10],b[10],c[10],i;
printf("Enter First array->");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
printf("\nEnter Second array->");
for(i=0;i<10;i++)
scanf("%d",&b[i]);
printf("Arrays before swapping");
printf("\nFirst array->");
for(i=0;i<10;i++){
printf("%d",a[i]);
}
printf("\nSecond array->");
for(i=0;i<10;i++){
printf("%d",b[i]);
}
for(i=0;i<10;i++){
//write any swapping technique
c[i]=a[i];
a[i]=b[i];
b[i]=c[i];
}
printf("\nArrays after swapping");
printf("\nFirst array->");
for(i=0;i<10;i++){
printf("%d",a[i]);
}
printf("\nSecond array->");
for(i=0;i<10;i++){
printf("%d",b[i]);
}
return 0;
}
More C Program :
- Write a c program for swapping of two arrays
- c program to swap two numbers using arrays
- swapping of two numbers using array in c
- write a c program to merge two arrays
- write a c program to merge two arrays into a sorted third array
- write a c program to swap two numbers without using the third variable
- write a c program to swap two numbers using pointers
- write a c program to swap two numbers using function
- write a c program to swap two numbers using call by value and call by reference
Learn More :
C Program
- Using Bash to input stuff into c program
- Difficult C Programming Questions
- Write a c program to find largest among three numbers using binary minus operator three numbers using binary minus operator
- PRINTING ASCII VALUE USING C PROGRAM
- MULTIPLICATION OF TWO MATRICES USING C PROGRAM
- FIND OUT SUM OF DIAGONAL ELEMENTS OF A MATRIX USING
- Write A C Program To Find Out Transport Of A Matrix
- Factorial of 100 in C Program
- Multiplication of large numbers in c
- Division of Large Numbers in C Program
- BINARY SEARCH USING C PROGRAM
- BINARY SEARCH THROUGH RECURSION USING C PROGRAM
- FIND FACTORIAL OF A NUMBER USING RECURSION IN C PROGRAM
- FIND GCD OF A NUMBER USING RECURSION IN C PROGRAM
- FIND SUM OF DIGITS OF A NUMBER USING RECURSION USING C PROGRAM
- FIND POWER OF A NUMBER USING RECURSION USING C PROGRAM
- REVERSE A NUMBER USING RECURSION IN C PROGRAM
- SWAP TWO VARIABLES WITHOUT USING THIRD USING C PROGRAM VARIABLE
- SWAPPING OF STRINGS USING C PROGRAM
- CONVERSION FROM DECIMAL TO OCTAL USING C PROGRAM
- CONVERSION FROM DECIMAL TO OCTAL USING C PROGRAM
- CONVERSION OF DECIMAL TO BINARY USING C PROGRAM
- CONVERSION OF FAHRENHEIT TO CENTIGRADE USING C PROGRAM
- C or C++ Program To Find Bonus Amount