In this program, you will take 5 numbers in an array from the user and copy them into another array in the same order.
#include<stdio.h>
int main()
{
int a1[5],a2[5],i;
printf("\n enter five element in array:");
for(i=0;i<5;i++)
scanf("%d",&a1[i]);
printf(" source array element are ");
for(i=0;i<5;i++)
printf("%d\t",a1[i]);
printf("\n copy array element are ");
for(i=0;i<5;i++)
a2[i]=a1[i];
for(i=0;i<5;i++)
printf("%d\t",a2[i]);
return 0;
}
enter five element in array:1 3 5 3 2 source array element are 1 3 5 3 2 copy array element are 1 3 5 3 2
a1[5], a2[5]