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


Please Help Members By Posting Answers For Below Questions

Does sprintf put null character?

607


What standard functions are available to manipulate strings?

567


C language questions for civil engineering

1250


What is a nested loop?

653


What is the scope of static variables in c language?

634






Is it valid to address one element beyond the end of an array?

677


Differentiate between #include<...> and #include '...'

621


What is a pointer value and address in c?

636


What are the uses of null pointers?

596


What is the meaning of 2d in c?

617


Why pointers are used?

634


Tell me when would you use a pointer to a function?

613


difference between object file and executable file

6102


Why doesn't C support function overloading?

1624


please explain every phase in the "SDLC" in the dotnet.

2182