Write a program that takes multiple values and you store the numbers in an array.?
-
Sort the array in ascending order based on the following ways: • Find the maximum number from the array of size n. • Swap the number with the last position (n) of the array. • Reduce your array size by 1 and then find the maximum again from (0 to n-1). • Swap the number with the n-1 position of the array • Continue until you have sorted the whole array.
-
Answer:
for(int i=0;i<n-1;i++) { id=0; for(j=0;j<n-i;j++) if( a[id]<a[j])id=j; T=a[id]; a[id]=a[n-1-i]; a[n-1-i]=T; }
Naman J at Yahoo! Answers Visit the source
Other answers
It might be useful to state what language the program is written in.
ray_diator
Related Q & A:
- How to write a program to monitor the temperature of CPU?Best solution by Stack Overflow
- How can display multiple values to single column?Best solution by Stack Overflow
- Can you suggest a camera that takes good pictures and video?Best solution by Yahoo! Answers
- Is there a bus that takes you directly to the OC Fair?Best solution by ocfair.com
- How to write a TV program proposal?
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.