@Yellow: Change the 12 in a[1] in your test case to 35 and see what you get.
Dave On Sep 23, 10:09 am, Yellow Sapphire <pukhraj7...@gmail.com> wrote: > I hope this will work. It finds the two minimum numbers and then prints the > difference. > > #include <stdio.h> > #include <stdlib.h> > void find_two_mins(int array[], int size) > { > int i,t; > int min1=array[0], min2=array[1]; > for (i=2; i<size; i++){ > t=array[i]; > if(t<=min1) { > min2=min1; > min1=t; > continue; > } > } > printf("\nMin elements are 1: %d 2: %d", min1,min2); > printf("\n Absolute difference between two minimum elements are %d", > abs(min1-min2)); > > } > > int main() > { > //int array[10]={ 9,2,3,4,1,7,5,6,8,0}; > // > int array[10]={99,12,45,33,88,9098,112,33455,678,3}; > find_two_mins(array,10); > return 0; > > > > }- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.