Write a c program to print the bubble sort using for loop

Write a c program to print the bubble sort using for loop. Bubble sort program in the C programming language. This program executed in the concept using bubble sort in C. This program executed in the concept using bubble sort in C. This working algorithm is a bit easier to execute and to understand the sorting program. Bubble sort is also one of the most important sorting methods in sorting algorithms. Click Here

#include<stdio.h>
int main()
{
int count, temp, i, j, num[30];
printf("Enter the numbers");
scanf("%d",&count);
printf("Enter %d nums: ",count);
for(i=0;i<count;i++)
scanf("%d",&num[i]);
for(i=count-2;i>=0;i--){
for(j=0;j<=i;j++){
if(num[j]>num[j+1]){
temp=num[j];
num[j]=num[j+1];
num[j+1]=temp;
}
}
}
printf("Sorted elements: ");
for(i=0;i<count;i++)
printf(" %d",num[i]);
return 0;
}
Output:
Enter the numbers3 
Enter 3 nums: 34 
45 
67 
Sorted elements: 34 45 67