I am new to C programming, This is my simple c program. It compiled successfully, but it is not executing, I don't know where is the problem. Please help me out.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
void bub_sort();
int arr[50], n;
void main()
{
    int i, j;
    system("cls");
    printf("Enter the numbers count: ");
    scanf("%d", &n);
    printf("Enter the %d integers: \n", n);
    for(i=0; i<n; i++)
    {
        scanf("%d", &arr[i]);
    }
    bub_sort();
    printf("\nIntegers in ascending order: \n");
    for(j=0; j<n; j++)
    {
        printf("%d\t", arr[i]);
    }
    getch();
}
void bub_sort()
{
    int i, j;
    for(i=0; i<n; i++)
    {
        for(j=0; i<n-1; j++)
        {
            if(arr[i] > arr[i+1])
            {
                int temp = arr[i];
                arr[i] = arr[i+1];
                arr[i+1] = temp;
            }
        }
    }
}
This program is getting input successfully but after that, it freezes up.
 
     
    