Dear Sir,
we are required the bubble sorting programs

Regs
Prem



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

Post New Answer

More C Interview Questions

what is op? for(c=0;c=1000;c++) printf("%c",c);

21 Answers   Trigent,


1. main() { printf("%d",printf("HelloSoft")); } Output?

3 Answers   HCL,


What does return 1 means in c?

0 Answers  


What will be the result of the following program? char*g() { static char x[1024]; return x; } main() { char*g1="First String"; strcpy(g(),g1); g1=g(); strcpy(g1,"Second String"); printf("Answer is:%s", g()); } (A) Answer is: First String (B) Answer is: Second String (C) Run time Error/Core Dump (D) None of these

2 Answers   Oracle,


count the numbers between 100 and 300, that star with 2 and ends with 2

5 Answers   Mind Tree,






write a c program to remove all the duplicate characters in a string and replace with single character? ex:-input- AAABBBCCC output- ABC

2 Answers   HCL,


AMMONG THE 4 STROAGE CLASSES IN C, WHICH ONE FASTEST?

13 Answers   HCL,


identify the in correct expression a.a=b=3=4; b.a=b=c=d=0; float a=int b=3.5; d.int a; float b; a=b=3.5;

8 Answers   TCS,


What compilation do?

7 Answers   Geometric Software, Infosys,


How can I convert a number to a string?

0 Answers  


In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.

0 Answers  


Write a program to swap two numbers without using the third variable?

0 Answers  


Categories