Counting Palindromes with a Certain Ending & an Announcement
Hello. With this small program comes a large, important update. I shall talk about it right after going over this small program.
The Program
In relations to the prior post about a program finding the next program. I have been tasked to make a program where it must find how many palindromes with a certain length exist with a certain ending. It turned out to be an easy task and I was able to code up the program in an afternoon. You can find it here on github.
The programs simply requests from the user a number to serve as the ending of a palindrome and a number serving as the length of the numbers being looked at. After getting two valid integers for both, by making sure they are positive integers, the program then does the following equation:
The Program
In relations to the prior post about a program finding the next program. I have been tasked to make a program where it must find how many palindromes with a certain length exist with a certain ending. It turned out to be an easy task and I was able to code up the program in an afternoon. You can find it here on github.
The programs simply requests from the user a number to serve as the ending of a palindrome and a number serving as the length of the numbers being looked at. After getting two valid integers for both, by making sure they are positive integers, the program then does the following equation:
z = roundup(length of numbers being looked at / 2) - length of first inputted number
If z is greater than or equal to 0, the program will return 10^z . Otherwise, it will return 0.
For instance, let's find the amount of palindromes with a length of 5 digits and ending with 84. Inputting these numbers into the equation gives this:
z = roundup(5/2) - (2) → z = 1
10 to the power of z will just be ten. This is true as there at 10 palindromes with 5 digits and ending with 84: 48084, 48184, 48284, 48384, 48484, 48584, 48684, 48784, 48884, and 48984. If there are no palindromes possible such as asking for a palindrome with 2 digits ending with 123, it will return 0. The program should work for all positive integers.
The Announcement
So, I have been doing some coding projects for a while now. Some easy, some mildly complex. I've wanted to do more explanations on these than the simple posts I do on this website.
I've considered doing videos on the creation of these programs. This will be my first videos I've done in a while, as before I've attempted to do let's play videos and livestreams some years ago. The videos will not be simple tutorials, but instead more like guides on GeeksForGeeks, though it's been some months since I used GFG. When I make a video on one of my programs, I'll start by explaining how the program works step by step. After that, I'll get into coding the program line by line.
When will I make one of these videos? Hopefully, I will make my first video soon. This is my channel which I will be using. Keep tuned for any new videos. See you next time.
I've considered doing videos on the creation of these programs. This will be my first videos I've done in a while, as before I've attempted to do let's play videos and livestreams some years ago. The videos will not be simple tutorials, but instead more like guides on GeeksForGeeks, though it's been some months since I used GFG. When I make a video on one of my programs, I'll start by explaining how the program works step by step. After that, I'll get into coding the program line by line.
When will I make one of these videos? Hopefully, I will make my first video soon. This is my channel which I will be using. Keep tuned for any new videos. See you next time.
Comments
Post a Comment