From b1e7613225ca6bd7068fe7be36c31ff718f7d96f Mon Sep 17 00:00:00 2001 From: Soumik Mukherjee Date: Sun, 4 Oct 2020 01:17:11 +0530 Subject: [PATCH] insertionSort in C lang added --- Sorting/Insertion Sort/insertionSort.c | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Sorting/Insertion Sort/insertionSort.c diff --git a/Sorting/Insertion Sort/insertionSort.c b/Sorting/Insertion Sort/insertionSort.c new file mode 100644 index 0000000..fb9bb29 --- /dev/null +++ b/Sorting/Insertion Sort/insertionSort.c @@ -0,0 +1,34 @@ + +/*INSERTION SORT MECHANISM */ + +#include +int main(){ + + int i, j, c, t, number[25]; + + printf("Enter the total number of elements:"); + scanf("%d",&c); + + printf("Enter %d elements: ", c); + // Loop to fill the array with the input numbers + + for(i=0;i=0)){ + number[j+1]=number[j]; + j=j-1; + } + number[j+1]=t; + } + + printf("Order of Sorted elements: "); + for(i=0;i