Hello I don\'t understand what I marked by red question mark Total is 5 question
ID: 3643168 • Letter: H
Question
Hello
I don't understand what I marked by red question mark
Total is 5 question mark
Please explain them respectively to understand this solution
Explanation / Answer
line no 22: Here you are starting a loop to check if the user has entered a 5 digit number or not. This loop continues till the user does not enter a five digit number i.e. (digits!=5) How do you check if the entered number has 5 digits? Simple, it must lie between 10000 - 99999. Is there any other number which has 5 digits? So how do you check it? If the number < 100000 and also number > 9999 [it is a compound conditional] it has 5 digits. Fine?? So when the user enters a 5 digit number, the while loop terminates. Now you have to store each digit in their respective variable. Remember: " / " gives quotient and " % " gives remainder for digit 1; u need the left most number; so we divide it by 10000 for eg: 98765 / 10000 => Quotient = 9; rem = 8765 so first digit is 9 for digit 2 u first need the remainder of the above division. and then need its left most digit. ryt? so 98765 % 10000 = 8765 [ from above ] and now 8765 / 1000 => quo :8 ; rem : 765 for digit 4: 98765 % 10000 % 1000 % 100 will give remainder as 65 den u divide it by 10 to get quo = 6 3rd digit is not calculated here; because it will remain on the 3rd position on reversing the digits ; being the central digit. this way you get all the digits any confusion?Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.