Skip to main content
/* This is a program in C language to copy all elements of a array into
another array in same order */

#include<stdio.h>
#include<conio.h>

void main()
{
int array1[10],array2[10],i;

clrscr();

// To enter elements of array1
printf("Enter 10 elements for array1 \n");
for(i=0;i<10;i++)
{
scanf("%d",&array1[i]);
}

// copying the elements of array1 into array2
for(i=0;i<10;i++)
{
array2[i]=array1[i];
}

// Displaying the elements of array2
printf("The elements of arrray2 are : \n");
for(i=0;i<10;i++)
{
printf("%d \n",array2[i]);
}

getch();

}

/*
Developed by
Avichal Vishnoi
on 2020.06.01 at 12:00 PM
*/

Comments

Popular posts from this blog

/* This is a program in C language to swap two numbers */ #include<stdio.h> #include<conio.h> void main() { int num1,num2,temp; clrscr(); // asking user to enter two numbers printf("Enter number1 :"); scanf("%d",&num1); printf("Enter number2 :"); scanf("%d",&num2); // swaping temp = num1; num1 = num2; num2 = temp; // printing swapped number printf("After swapping \nnumber1 = %d \nnumber2 = %d",num1,num2); getch(); } /* Developed by Avichal Vishnoi on 2020.06.02 at 11:15 AM */
/* This is a program in C language  to check that an array is sorted or not */ #include<stdio.h> #include<conio.h> void main() { int array[10],i; clrscr(); // ask user to enter numbers in array printf("Enter 10 numbers \t:"); for(i=0;i<10;i++) scanf("%d",&array[i]); // to check the sorted array  in ascending order for(i=1;i<10;i++) { if(array[i]<array[i-1]) { printf("This array is not sorted in ascending order"); getch(); exit(0); } } printf("This array is sorted in ascending order"); getch(); }