From c21dac96778402e9acea11431cce5efc167605f6 Mon Sep 17 00:00:00 2001 From: ankay212000 Date: Fri, 28 Jun 2019 13:31:48 +0530 Subject: [PATCH 1/3] resolve issue#111 --- programs/Python/sorting.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 programs/Python/sorting.py diff --git a/programs/Python/sorting.py b/programs/Python/sorting.py new file mode 100644 index 0000000..e06e4ee --- /dev/null +++ b/programs/Python/sorting.py @@ -0,0 +1,18 @@ +arr=[] +num=int(input("enter no. of elements: ")) #no. of elements in the array +for i in range(num): + element=int(input("element"+str(i+1)+": ")) + arr.append(element) +print("Original array: ") +print(arr) +#sort function +def sorting(arr): + for i in range(n): + for j in range(i+1,n): + if (arr[i]>arr[j]): + temp=arr[i] + arr[i]=arr[j] + arr[j]=temp + return arr +print("sorted array: ") +print(sorted(arr)) From ce27e971ee3faa0d93ef1604907bfb196c759b55 Mon Sep 17 00:00:00 2001 From: ankay212000 Date: Tue, 1 Oct 2019 20:53:28 +0530 Subject: [PATCH 2/3] resolve issue #110 from ankay212000 --- programs/C++/sort_integer_array.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 programs/C++/sort_integer_array.cpp diff --git a/programs/C++/sort_integer_array.cpp b/programs/C++/sort_integer_array.cpp new file mode 100644 index 0000000..6eab30c --- /dev/null +++ b/programs/C++/sort_integer_array.cpp @@ -0,0 +1,24 @@ +#include + +using namespace std; + +int main() +{ + int n; + cout<<"Enter the number of elements: "; + cin>>n; + int a[n]; + int temp; + for(int i=0;i>a[i]; + for(int i=0;ia[j]) + { + temp=a[j-1]; + a[j-1]=a[j]; + a[j]=temp; + } + } + for(int i=0;i Date: Tue, 1 Oct 2019 23:11:28 +0530 Subject: [PATCH 3/3] resolve issue #109 by ankay212000 --- programs/C/sort.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 programs/C/sort.c diff --git a/programs/C/sort.c b/programs/C/sort.c new file mode 100644 index 0000000..83a4d3a --- /dev/null +++ b/programs/C/sort.c @@ -0,0 +1,21 @@ +#include +int main() +{ + int n,i,j,temp; + printf("Enter the number of elements: "); + scanf("%d",&n); + int a[n]; + for(i=0;ia[j]) + { + temp=a[j-1]; + a[j-1]=a[j]; + a[j]=temp; + } + } + for(i=0;i