From c21dac96778402e9acea11431cce5efc167605f6 Mon Sep 17 00:00:00 2001 From: ankay212000 Date: Fri, 28 Jun 2019 13:31:48 +0530 Subject: [PATCH 1/2] 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 635d559e26a6313a2944376e09bfbe7e1d6a0b84 Mon Sep 17 00:00:00 2001 From: ankay212000 Date: Wed, 2 Oct 2019 16:21:08 +0530 Subject: [PATCH 2/2] resolve issue#106 by ankay212000 --- programs/C++/Add_elements.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 programs/C++/Add_elements.cpp diff --git a/programs/C++/Add_elements.cpp b/programs/C++/Add_elements.cpp new file mode 100644 index 0000000..7153877 --- /dev/null +++ b/programs/C++/Add_elements.cpp @@ -0,0 +1,15 @@ +#include + +using namespace std; + +int main() +{ + int num_elem; + cout<<"Enter number of element: "; + cin>>num_elem; + int arr[num_elem]; + for(int i=0;i>arr[i]; + int sum=0; + for(int i=0;i