0

Need a program To find the missing num in a sorted array of 1 to 10 nmbrs. lyk dis array = (1,2,3,4,?,6,7,8,9,10) and o/p as 5

missing num

27th Jul 2017, 3:19 PM
Mohammed Suhail
Mohammed Suhail - avatar
3 Respuestas
0
you only need a for (it is in python but u can rewrite it in any language u want) for i in range(0,11): if(arr[ i ] != (i+1)): print("missing number found, it is ", (i+1)) break
27th Jul 2017, 3:40 PM
Matte
Matte - avatar
0
run a loop to increment an int from 0 to 10 now in that loop only use index for the array which u r using. if the value of that index is equal to that of int which u r incrementing continue otherwise add its value in that index.
27th Jul 2017, 3:42 PM
shobhit
shobhit - avatar
0
This will tell you all the missing numbers in any array from the lowest number to the highest number https://code.sololearn.com/c2x1dAXrEQOl/?ref=app
27th Jul 2017, 4:11 PM
LordHill
LordHill - avatar