Write a program to copy the elements of one array into another array
- #include <stdio.h>
- void main()
- {
- int arr1[100];
- int arr2[100];
- int i, n;
- printf("Input the number of elements to be stored in the array : ");
- scanf("%d", &n);
- printf("Enter %d elements in the array :\n", n);
- for(i=0; i<n; i++) {
- printf("Element - %d : ", i);
- scanf("%d", &arr1[i]);
- }
- //Copy elements of first array into second array
- for(i=0; i<n; i++) {
- arr2[i] = arr1[i];
- }
- printf("The elements copied from first array into second array : ");
- for(i=0; i<n; i++) {
- printf("%5d", arr2[i]);
- }
- }
একটি মন্তব্য পোস্ট করুন