#include <iostream>
using namespace std;
void insertionSort(int *arr,int n){
int i, temp, j;
for (i = 1; i < n; i++)
{
temp = arr[i];
j = i-1;
while (j >= 0 && arr[j] > temp)
{
arr[j+1] = arr[j];
j = j-1;
}
arr[j+1] = temp;
}
}
int main()
{
int arr[5],counter=0;
for(int i=0;i<5;i++){
cout<<"Enter a Number : ";
cin>>arr[i];
counter++;
insertionSort(arr,counter);
for(int j=0;j<counter;j++){
cout<<arr[j]<<" ";
}
cout<<endl;
}
return 0;
}
The Rapid growth of technology and infrastructure has made our lives easier. The advent of...
Electromagnetic braking means braking with electronic and magnetic energy. Here, we use th...
Since the outbreak of Covid-19, different type of thermometers are being used as...
The load pressure on electrical power system is increased during last decade. The installa...
Fleet management is an admini...