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
How can I get random integers in a certain range?
Tell us something about keyword 'auto'.
What is the ANSI C Standard?
What is c mainly used for?
Explain data types & how many data types supported by c?
Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)
What is meant by keywords in c?
What is malloc return c?
Which is better pointer or array?
Can you assign a different address to an array tag?
What is oops c?
How main function is called in c?
What is main () in c?
What is ## preprocessor operator in c?
What does the characters “r” and “w” mean when writing programs that will make use of files?