Swapping of Arrays C Program

This program accepts 20 numbers from user & stored in array of size 10 each & swap the value in these array at the corresponding location. This is a part of  Mumbai University MCA Colleges C Program MCA Sem 1


#include<stdio.h>
#include<conio.h>
void main()
{
            int i,j,a[10],b[10],temp,k;
            clrscr();
            printf("Enter the number in first array:\n");
            for(i=0;i<10;i++)
            {
                        scanf("%d",&a[i]);
            }
            printf("Enter the number in second array:\n");
            for(j=0;j<10;j++)
            {
                        scanf("%d",&b[j]);
            }
            for(k=0;k<10;k++)
            {
                        temp=a[k];
                        a[k]=  b[k];
                        b[k]=temp;
                        printf("\n");
                        printf("The swapping number is :");
                        printf("%d\t%d\n",a[k],b[k]);
            }
            getch();
 }

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

No comments:

Post a comment