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

What is the benefit of using #define to declare a constant?

601


What is calloc()?

625


What is the purpose of type declarations?

673


What is oops c?

602


What is the use of extern in c?

639






Which is better oop or procedural?

628


Is flag a keyword in c?

677


What are the features of c language?

617


What does != Mean in c?

582


What is a program flowchart and how does it help in writing a program?

658


number of times a digit is present in a number

1539


What is else if ladder?

603


code for find determinent of amatrix

1513


What is variables in c?

602


What is a far pointer in c?

592