Some Programming Challenges

If you want to improve your programming creativity and skills then you must have do practice some programming challenges. Solving programming challenges will boost your creativity which will directly improve your programming skills. Because programming is not just about typing but it’s the ability of someone to solve problems. Here are some of the programming challenges which you must solve if you really want to improve your programming skills. If you’re really a beginner and you don’t know how to learn to programme and from where to start programming and which language should I start with, then you must visit How to learn to programme.

The following are the programming challenges.

Problem #1 [Factorial Finder]

The Factorial of a positive integer, n, is defined as the product of the sequence n, n-1, n-2 …1 and the factorial of zero, 0, is defined as being 1. Solve this using both loops and recursion.

Problem #2 [Speed Tracker]

Create a program that takes a time for a car going past a speed camera, the time going past the next one and the distance between them to calculate the average speed for the car in mph. The cameras are one mile apart.


Speed cameras know the timings of each car going past, through number plate recognition. Valid number plates are two letters, two numbers, and three letters afterward, for example, XX77 787. Produce a part of the program that checks whether a number plate matches the given pattern. Tell the user either way.

Create a program for creating a file of details for vehicles exceeding the speed limit set for a section of road. You will need to create a suitable file with test data, including randomized number plates and times. You will then use the code you’ve already written to process this list to determine who is breaking the speed limit (70mph) and who has invalid number plates.

Problem #3 [Thief]

A thief has managed to find out the four digits for an online PIN code but doesn’t know the correct sequence needed to hack into the account.

Design and write a program that displays all the possible combinations for any four numerical digits entered by the user. The program should avoid displaying the same combination more than once.

Problem #4 [Classification]

A simple classification system asks a series of Yes/No questions in order to work out what type of animal is being looked at.

E.g. does it have 4 legs? Does it eat meat? Does it have stripes?

Can these systems often be drawn using a “tree? structure. Carry out some simple research on classification trees, then write a program to help the user decide between the following:

Horse, cow, sheep, pig, dog, cat, lion, tiger, whale, dolphin, seal, penguin, ostrich, sparrow, spider, ant, bee, wasp, termite, octopus, squid

Is there a better way to do this than using 101 IF…ELSE…END IFs?

Develop your classification system for your own area of interest: pop bands; Pokémon; cars; footballers; teachers; diseases etc.

Problem #5 [Fruit Machine]

Write a program to simulate a Fruit Machine that displays three symbols at random from Cherry, Bell, Lemon, Orange, Star, and Skull.

The player starts with £1 credit, with each goes costing 20p. If the Fruit Machine “rolls�? two of the same symbol, the user wins 50p. The player wins £1 for three of the same and £5 for 3 Bells. The player loses £1 if two skulls are rolled and all of his/her money if three skulls are rolled. The player can choose to quit with the winnings after each roll or keep playing until there is no money left.

Problem #6 [Unit Converter (temp, currency, volume)]

Converts various units to one another. The user enters the type of unit being entered, the type of unit they want to convert to and then the value. The program will then make the conversion.

Problem #7 [Credit Card Validator]

Takes in a credit card number from a common credit card vendor (Visa, MasterCard, American Express, and Discoverer) and validates it to make sure that it is a valid number (look into how credit cards use a checksum).

Problem #8 [Arithmetic test]

A primary school teacher wants a computer program to test the basic arithmetic skills of her students. Generate random questions (2 numbers only) consisting of addition, subtraction, multiplication, and division.

The system should ask the student’s name and then ask ten questions. The program should feedback if the answers are correct or not, and then generate a final score at the end.


Extend your program so that it stores the results somewhere. The teacher has three classes, so you need to enable the program to distinguish between them.

The teacher wants to be able to log student performance in these tests. The teacher would like the program to store the last three scores for each student and to be able to output the results in alphabetical order with the student’s highest score first out of the three.

Problem #9 [Happy Numbers]

A happy number is defined by the following process:

Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers. Display an example of your output here. Find the first eight happy numbers.

Problem #10 [Number Names]

Show how to spell out a number in English. You can use a pre-existing implementation or make your own, but you should support inputs up to at least one million (or the maximum value of your language’s default bounded integer type if that’s less).


Create support for inputs other than positive integers (like zero, negative integers, and floating-point numbers).

Leave a Reply

Your email address will not be published. Required fields are marked *