Write down the program to sort the array.

Answer Posted / ashutosh shashi

for(i=0;i<n-1;i++)
{
for(j=0;j<n-i-1;j++)
{
if(arr[j] >a[j+1])
{
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}

Is This Answer Correct ?    15 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a char in c?

725


How pointers are declared?

705


What is getch?

810


What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }

2211


How variables are declared in c?

746






how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

3010


Why double pointer is used in c?

732


What is string concatenation in c?

734


Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.

2881


How macro execution is faster than function ?

838


Can you add pointers together? Why would you?

831


What is the value of a[3] if integer a[] = {5,4,3,2,1}?

842


When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd

808


Explain goto?

881


Write a program to know whether the input number is an armstrong number.

861