#include<iostream> using namespace std; int main(){ int num[20], n, j,tmp; cout<<"Enter n:";cin>>n; for(int i=0;i<n;i++){ cout<<"Enter Number:",i; cin>>num[i]; } cout<<"\noutput Before sort\n"; for(int i=0;i<n;i++){ cout<<num[i]; cout<<"\t"; } for(int i=0;i<n;i++){ tmp= num[i]; j=i; while(j>0 && num[j-1]>=tmp){ num[j]=num[j-1]; --j; } num[j]=tmp; } cout<<"\noutput insertion sort\n"; for(int i=0;i<n;i++){ cout<<num[i]; cout<<"\t"; } return 0; }

`In this program we sort the numbers using insertion sort method.`