Dear Sir,
we are required the bubble sorting programs
Regs
Prem
Answer / 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 |
Explain why C language is procedural?
What is a string?
Does c have circular shift operators?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
How can I make it pause before closing the program output window?
Explain the difference between malloc() and calloc() in c?
How do you list files in a directory?
#define MAX 3 main() { printf("MAX = %d ",MAX ); #undef MAX #ifdef MAX printf("Vector Institute”); #endif }
How do you initialize function pointers? Give an example?
Difference between goto, long jmp() and setjmp()?
read an array and search an element
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above