[Solved] What am I doing wrong? The loop runs infinitely….P.S.- I am a newbie [closed]
There are basically two mistakes in your logic First is when you are finding smallest number if(a[k]<small) { small=a[k]; } This is wrong as there will some condition arise when a[k] will be 0. So each time when the loop runs small will always be zero. See for example So it should be replace with … Read more