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
Does sprintf put null character?
What standard functions are available to manipulate strings?
C language questions for civil engineering
What is a nested loop?
What is the scope of static variables in c language?
Is it valid to address one element beyond the end of an array?
Differentiate between #include<...> and #include '...'
What is a pointer value and address in c?
What are the uses of null pointers?
What is the meaning of 2d in c?
Why pointers are used?
Tell me when would you use a pointer to a function?
difference between object file and executable file
Why doesn't C support function overloading?
please explain every phase in the "SDLC" in the dotnet.