Shell sort

i m trying shell sort
can u look please look at my program. according to what i have written it should keep sorting until i
i =1…
but it only sorts once.when i enter no. 4 for the maximum value of no. of array…then it gets sorted but when i used 8 it only sorts once.

//shell sort
#include<stdio.h>
#define max 100
int array[max];
void input(int n)
{
for(int i=0;i<n;i++)
{
printf(“array[%d] = “,i);
scanf(”%d”,&array[i]);
}
}
void display(int n)
{
for(int i=0;i<n;i++)
{
printf("%d “,array[i]);
}
printf(”\n");
}
void sort(int n)
{
int gap=n/2;
int temp;
for(int i=gap;i>0;i/=2)
{
for(int j=0;j<i;j++)
{
if(array[j]>array[j+i])
{
temp=array[j+i];
array[j+i]=array[j];
array[j]=temp;
}
}
}
}
int main()
{
int n;
printf(“enter number “);
scanf(”%d”,&n);
input(n);
sort(n);
display(n);
return 0;
}