Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Array/Combine_two_arrays.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include<stdio.h>
void main(){
int a[20], b[20],c[60],size1,i,size2,size,k,j;
printf("\n enter the size of the first array:");
scanf("%d",&size1);
printf("\n enter the element of the first array :");
for(i=0;i<size1;i++){
scanf("%d",&a[i]);
}
for(i=0;i<size1;i++){
c[i]=a[i];
}
printf("\n enter the size of the second array:");
scanf("%d",&size2);
printf("\n enter the element of the seccond array: \n ");
for(j=0;j<size2;j++){
scanf("%d",&b[j]);

}
size=size1+size2;
for(k=size1;k<=size;k++){
c[k]=b[k-size1];

}
printf("\n Combined Array is \n ");
for(k=0;k<size;k++){

printf("%d ",c[k]);
}



}

36 changes: 36 additions & 0 deletions Array/reverse_array.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

/*

enter the size of the array:5

enter the 5 element of the array:
2 6 7 9 1

The reverse array:
1 9 7 6 2
*/

#include<stdio.h>
void main(){
int array[20], b[20],size,i,s;
printf("\n enter the size of the array:");
scanf("%d",&size);
printf("\n enter the %d element of the array: \n ",size);
for(i=0;i<size;i++){
scanf("%d",&array[i]);

}
s=size-1;
for (i = 0; i <size; i++)
{
b[i]=array[s];
s--;
}
printf("\n The Reverse array: \n ");

for (i = 0; i <size; i++)
{
printf("%d ",b[i]);
}
}