0% found this document useful (0 votes)
21 views

C Programming Language

Copy Elements to Another Array

Uploaded by

Jam Cavs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

C Programming Language

Copy Elements to Another Array

Uploaded by

Jam Cavs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <stdio.

h>

void main()
{
int arr1[100], arr2[100];
int i, n;

printf("\n\nCopy the elements one array into another array :\n");


printf("----------------------------------------------------\n");

printf("Input the number of elements to be stored in the array :");


scanf("%d",&n);

printf("Input %d elements in the array :\n",n);


for(i=0;i<n;i++)
{
scanf("%d",&arr1[i]);
}
/* Copy elements of first array into second array.*/
for(i=0; i<n; i++)
{
arr2[i] = arr1[i];
}

/* Prints the elements of first array */


printf("\nThe elements stored in the first array are :\n");
for(i=0; i<n; i++)
{
printf("% 5d", arr1[i]);
}

/* Prints the elements copied into the second array. */


printf("\n\nThe elements copied into the second array are :\n");
for(i=0; i<n; i++)
{
printf("% 5d", arr2[i]);
}
printf("\n\n");
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy