First and Last Digit | Codechef | Python
Nov 22, 2022
Hello everyone...! welcome to Girl Coder. In this video you will be learning how to solve First and Last digit from beginner level in Codechef. The question is all about adding the first and last digit of the given series of integers.
This problem is quite simple to solve. All you need to do is to obtain first digit and last digit of the given integer, add those two digits and display the added result. Continue this until the sum of digits of series of integers get displayed.
In order to do the sum, you need to get first digit and last digit. The logic behind first digit is totally easy. You'll use the operator called floor division("//") to achieve first digit and you will understand it better. To get the last digit you're going to apply mod operation among the integer. After getting first and last digits you will add them and save it in some variable. You'll continue this task until all integers are done. until what extent you'll do this operation will be decided by the test case variable. Where test case variable declares the size of the input.
If you wanna tackle this question then right away go to this link :
https://www.codechef.com/problems/FLOW004
If you have any queries or any trouble on clearing errors then let me know in the comment box or mail to my official mail [email protected]. So that I can help you out by working on them.
Are you interested to solve any of the problems in codechef then follow this playlist : https://www.youtube.com/playlist?list=PLgNt4G2QEfRDuY74dvYUBpUR-xp27jTW1
for further updates follow me on instagram : https://www.instagram.com/girl_coder_impressive/
You can also follow my facebook page for more updates :
https://www.facebook.com/Girl_Coder_impressive-101934658207369/
Show More Show Less #Puzzles & Brainteasers
