-
Notifications
You must be signed in to change notification settings - Fork 0
/
Recursion2.c
57 lines (39 loc) · 925 Bytes
/
Recursion2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Name Ankesh Sharma
// Date 03-01-2024
// Language C
#include <stdio.h>
#include <conio.h>
#include <string.h>
int reversearray(int n,int arr[],int bag[],int start,int end);
int main(){
int start ,end,index ,n;
start = 0;
index = 0;
printf("Enter the value of n : ");
scanf("%d",&n);
end = n-1;
int arr[n];
int bag[n];
printf("Enter the value for array : ");
for(int i=0;i<n;i++){
scanf("%d",&arr[i]);
}
int anss = reversearray(n,arr,bag,start,end);
printf("Sorted array: ");
for (int i = 0; i < n; i++) {
printf("%d ", bag[i]);
}
// printf("%d",bag);
printf("Hey Buddyyyy!!!!");
}
int reversearray(int n,int arr[],int bag[],int start,int end){
if(start>n){
return 0;
}
else{
bag[start] = arr[end];
return reversearray(n,arr,bag,start+1,end-1);
}
}
int sort(){
}