text: Find the last two missing digits of the given phone number | Function to find the last two digits of the number and print the complete number ; Sum of the first eight digits of the number ; if sum < 10 , then the two digits are '0' and the value of sum ; if sum > 10 , then the two digits are the value of sum ; Driver code
code: function findPhoneNumber ( n ) { let temp = n ; let sum = 0 ; while ( temp != 0 ) { sum += temp % 10 ; temp = Math . floor ( temp / 10 ) ; } if ( sum < 10 ) document . write ( n + " " + sum ) ; else document . write ( n + " " + sum ) ; } let n = 98765432 ; findPhoneNumber ( n ) ;