English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

write the full coding so that i can get some marks in tommorows exams..correct answer shall be rewarded

2007-03-06 01:10:21 · 4 answers · asked by spiker 1 in Computers & Internet Programming & Design

4 answers

If this is for class, bear in mind that no one really wants the problem solved - they want you to write C.

Having said that, bubble sort (or any full sort) is overkill. If all you want are the two smallest numbers, just iterate over (loop through) the set of numbers in question, compare each of them to two you have saved in variables and replace either one if you find a smaller one.

2007-03-06 02:21:29 · answer #1 · answered by RPK 3 · 0 0

no YOU write it

I think a concept called bubble sort is relevant

write the program so it will select the first number , then compare it with each of the other numbers, saving the smallest as the result

2007-03-06 09:14:31 · answer #2 · answered by Anonymous · 1 0

do a internet search on C Bubble Sort. in an ascending sort, the first two array elements are your smallest and second smallest

A very common function.

Good luck

2007-03-06 09:20:43 · answer #3 · answered by Jeffrey F 6 · 0 0

there is no such thing as a smallest number.
you can always go to smaller decimals.

you would reach the computer number limits before you could get a real figure.

it would also be affected by the size of the float (a 32bit float wont go as small as a 64bit float)

2007-03-06 09:16:40 · answer #4 · answered by Josh H 2 · 0 1

fedest.com, questions and answers