Dear Sir,
we are required the bubble sorting programs
Regs
Prem
Answer Posted / vignesh1988i
DESCENDING ORDER Bubble sorting
#include<stdio.h>
#include<conio.h>
void main()
{
int a[100],n;
printf("enter the number of elements :");
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n-1;i++)
for(j=0;j<n;j++)
if(a[j]<a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<n;i++)
printf("%d\n",a[i]);
getch();
}
thank u
Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What is the benefit of using #define to declare a constant?
What is calloc()?
What is the purpose of type declarations?
What is oops c?
What is the use of extern in c?
Which is better oop or procedural?
Is flag a keyword in c?
What are the features of c language?
What does != Mean in c?
What is a program flowchart and how does it help in writing a program?
number of times a digit is present in a number
What is else if ladder?
code for find determinent of amatrix
What is variables in c?
What is a far pointer in c?