Category Archives: Programs

Check if a Number is Triacontakaidigon

Given an integer N, the task is to check if it is a Triacontakaidigon number or not. Triacontakaidigon number is class of figurate number. It has 32 – sided polygon called Triacontakaidigon. The N-th triacontakaidigon number count’s the 32 number of dots and all others dots are surrounding with a common sharing corner and make a pattern. The… Read More »

Check if a Number is Hexacontagon

Given an integer N, the task is to check if it is a hexacontagon number or not. Hexacontagon number is class of figurate number. It has 60 – sided polygon called hexacontagon. The N-th hexacontagon number count’s the 60 number of dots and all others dots are surrounding with a common sharing corner and make a pattern. The… Read More »

Python Program to Swap String Case Without Using swapcase()

Generally, we use swapcase() to swap strings in Python. What if we are asked to do swapping without using the method. In this article, I will be sharing python program to swap upper case letters to lower case and vice versa in the same string. Examples: Input: “w3ColLeges” Output: “W3cOLlEGES” Input: “W3cOlLegEs OrG” Output: “w3CoLlEgEs oRg” Some  letters… Read More »

Easy Multi-Layered Calculation

Count the number of even/odd results after performing a series of calculation on a range of numbers. Given that: Each layer of calculation have two numbers (say a and b) associated with it. For each input x, y = ax + b is calculated. The result of layer i, i.e y, becomes input for layer i+1. The range… Read More »