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 purpose of type declarations?
What is data type long in c?
Is fortran still used today?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
What are the standard predefined macros?
What is c language in simple words?
What is the explanation for cyclic nature of data types in c?
What is difference between arrays and pointers?
What are the key features in c programming language?
How do you determine whether to use a stream function or a low-level function?
What are the primitive data types in c?
Which of these functions is safer to use : fgets(), gets()? Why?
What are reserved words?
What is time complexity c?
What are the uses of null pointers?