View on GitHub

programming-ideas

I created this repository to develop solutions for the "Programming Ideas 2" app, developed by Mbah Clinton

Numbers

  1. Distance Between Two Cities

    Difficulty: Beginner

Develop a program that calculates the distance between two cities and allows the user to specify a unit of distance. This program may require finding coordinates for the cities like latitude and longitude.

  1. Tax Calculator

    Difficulty: Beginner

Develop a program that asks the user to enter a cost and either a country or state tax. It then returns the tax plus the total cost with tax.

  1. Factorial Finder

    Difficulty: Beginner

The Factorial of a positive integer, n, is defined as the product of the sequence n, n-1, n-2, …1. Also the factorial of zero, 0, is defined as being 1. Develop a program that solves the factorial of any user given number using both loops and recursion.

  1. Happy Numbers

    Difficulty: Beginner

A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the sqaures of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which doas not include 1. Those numbers for which this process end in 1 are happy numbers, while those that do not end in 1 are unhappy numbers. Find the first 8 happy numbers.

  1. Coin Flip Sumulation

    Difficulty: Beginner Write some code that simulates flipping a single coin however many times the user decides. The code should record the outcomes and count the numbers of tails and heads.

  2. Household Budget Program

    Difficulty: Expert

Create a full GUI program that allows the user to enter in and setup a household budget. They can enter in unlimited number of budget categories like Utilities, Travel Expenses, or Child Cate. Then let the use enter in X number of sub-items for each of these categories listing their monthly expenses along with any income items. Have the program keep track of their expenses and their cash flow. This program should let the user know if they are overspending o how much they are saving for the month or year.

  1. Calculator

    Difficulty: Intermediate

A simple calculator to do basic operations. Make it a scientific calculator for added complexity.

  1. Find Pi to the Nth Digit

    Difficulty: Beginner

Develop a program that has the user enter a number. Your program should print out Pi up to that many decimal places. Try to keep a limit as to how far the program will go.

  1. Find e to the Nth Digit

    Difficulty: Beginner

Develop a program that has the user enter a number. Your program should print out ‘e’ up to that many decimal places. Keep a limit as to how far the program will go.

  1. Fibonacci Sequence

    Difficulty: Beginner

Develop a program that has the user enter a number. Your program should print out the Fibonacci sequence to that number or to the Nth number.

  1. Prime Factorization

    Difficulty: Beginner

Develop a program that has the user enter a number and find all the Prime Factors (if there are any) and display them.

  1. Next Prime Number

    Difficulty: Beginner

Develop a program that starting at any number the user inputs, generates the next prime number. Ask the user for confirmation to keep going, if it is granted print the next prime number again otherwise quit the program.

  1. Mortgage Calculator

    Difficulty: Intermediate

Develop a program that calculate the monthly payments of a fixed term mortgage over given Nth terms at a given interest rate. Also, figure out how long it will take the user to pay back the loan. For added complexity, add an option for users to select the compounding interval (Monthly, Weekly, Daily, Continually).

  1. Change Return Program

    Difficulty: Beginner

Develop a program that has the user enter the cost of an item and then the amount the user paid for the item. Your program should figure out the change and the number of quarters, dimes, nickels, pennies needed for the change.

  1. Binary to Decimal and Back Converter

    Difficulty: Intermediate

Develop a program that converts a decimal number to binary or a binary number to its decimal equivalent. For added complexity, try adding converters to Octals and Hexadecimals too.

  1. Alarm Clock

    Difficulty: Intermediate

Develop a simple alarm clock that plays a sound after X number of minutes/seconds or at a particular time. For added complexity, add the ability to add sticky notes and a date to the alarm.

  1. Unit converter

    Difficulty: Beginner

Develop a program that converts various units between 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.

  1. Least/Greatest Common Denominator

    Difficulty: Beginner

Create a program that asks the user to enter two fractions. Have the program find the least common or the greatest common denominator between those two fractions and print it out.

  1. Kaprekar numbers

    Difficulty: Intermediate

In mathematics, a Kaprekar number for a given base is a non-negative integer, the representation of whose square in that base can be split into two parts that add up to the original number again. For instance, 45 is a Kaprekar number, because 452 = 2025 and 20+25 = 45. The Kaprekar numbers are named after D. R. Kaprekar. Your program will receive two integers per line telling you the start and end of the range to scan, inclusively. Example: ‘1 50’. Your program should emit the Kaprekar numbers in that range. From the example: 45 is the Kaprekar number in that range. For your program focus only on base 10 numbers. For added complexity, see if you can make it work in arbitrary bases.

  1. Guess the Number

    Difficulty: Intermediate

Your program asks the user to guess and number and keep it in their head. It then asks the user to input a range that would dictates the maximum and minimun range your program should guess the number from. If your program guesses too high or too low, the user should be able to input “too high” or “too low” to notify you to fix your guess.

Submitted by Sebastien Cadot

  1. Find the N-th Natural Number

    Difficulty: Intermediate

The task is to find which natural number (or rather a digit between 0-9) is at the 1986th position. The number range is from 1 to 1000.

Optionally find the number that the 0-9 digit is a part of.

Example:

Given number range from 1-20 (1234567891011121314151617181920) the digit at position 17 would be ‘3’ and it is a part of number ‘13’.

Submitted by Dusan N.

  1. Neon Number

    Difficulty: Intermediate

A number is said to be a Neon Number if the sum of digits of the square of the number is equal to thenumber itself. Example- 9 is a Neon Number. 9*9=81 and 8+1=9.Hence it is a Neon Number. The user is prompted to input a range eg 1-90. Your program should print out the neon numbers in that range.

Submitted by Shib Shankar Ghosh

  1. Hady-Ramanujan Number

    Difficulty: Intermediate

1729 is a Hardy-Ramanujan number. It is the smallest number representable in two ways as a sum of two cubes.

        1729 = 12^3 + 1^3
        Also, 1729 = 10^3+9^3

Your program should generate all numbers between 1 and n that can be expressed as the sum of two cubes in two or more ways.

Submitted by Izaki Bikas

  1. Romn Number Generator

    Difficulty: Intermediate

Develop a program that accepts an integer and outputs the Roman Number equivalent of that number.

Examples:

4 - IV 12 - XII 20 - XX

Submitted by SoReNa

  1. Newtonian Gravity Simulation

    Difficulty: Expert

Create an application that simulate Newtonian gravity. There are lots of ways to do this! Use threading for a performance boost. This is probably best done in a compiled language, as there are lots of complex calculations to do.

Example: http://justfound.co/gravity/ More info: https://en.wikipedia.org/wiki/Gravity

Submitted by osmarks

  1. Pascal’s Triangle

    Difficulty: Intermediate

Create a program to print the Pascal’s Triangle representation for a number N where N is an integer specified by the user.

For more info on Pascal’s Triangle, look here: https://en.m.wikipedia.org/wiki/Pascal’s_triangle

Submitted by Imperial_Squid

  1. Vigenere Cipher

    Difficulty: Intermediate

Make a program to accept some plaintext and a key from the user and use them to perform a Vigenère Cipher and output the result.

More info on Vigenère Ciphers: https://en.m.wikipedia.org/wiki/Vigenère_cipher

Bonus points: Give the user a message if their input is invalid (empty/just numbers/etc)

Submitted by Imperial_Squid

  1. Gray Code

    Difficulty: Intermediate

Gray code, so named after discoverer Frank Gray, is a binary numeral system where two successive values differ in only one bit (binary digit). The reflected binary code was originally designed to prevent spurious output from electromechanical switches. Today, Gray code is widely used to facilitate error correction in digital communications such as digital terrestrial television and some cable TV systems.

Gray code differs from regular binary counting sequences in one key way: because sequential values can have only a single bit difference from their predecessor, you wind up with a non-linear progression of base 10 integers.

IMPORTANT: Read the document linked below as it is important to be able to implement this idea > https://docs.google.com/document/d/17U_sV5wZr-ioHg-llR3xJIoWVh0iJOoq_7bP1DebQeU/edit?usp=sharing

Write a program that can generate a Gray code sequence of a decimal the user inputs. For example, if you were given input = 2 your program should emit:

00 01 11 10 - 2

  1. Lotto

    Difficulty: Beginner

Create a program which asks for 6 numbers in the range 1-49. The program should then display 6 random numbers from the same range. and check how many numbers the user guessed correctly. For added complexity, make the program into a mini-game. Allow the user to retry the lotto, show their payout after each round, their highest payout etc. Feel free to add as much complexity as you want.

Submitted by Filipekczek7

  1. Roman to Arabic numeral converter

    Difficulty: Beginner

Create a program that converts Roman numbers (such as MCMLIV) to Arabic numbers (1954) and back.

Roman numerals are read from left to right, as you add or subtract the value of each symbol.

If a value is lower than the following value, it will be subtracted. Otherwise it will be added.

For example, we want to convert the Roman numeral MCMLIV to an Arabic number:

M = 1000 must be added, because the following letter C =100 is lower. C = 100 must be subtracted because the following letter M =1000 is greater. M = 1000 must be added, because the following letter L = 50 is lower. L = 50 must be added, because the following letter I =1 is lower. I = 1 must be subtracted, because the following letter V = 5 is greater. V = 5 must be added, because there are no more symbols left.

We can now calculate the number: 1000 - 100 + 1000 + 50 - 1 + 5 = 1954

Submitted by Alex Lushiku

  1. Circular Primes

    Difficulty: Intermediate

A number is a circular prime if all of its cycles are also primes.

To cycle a number just take its first digit and stick it on its end. For example, 197 -> 971 -> 719 -> 197.

Make a program that takes in a input of a number and outputs if the given number is a circular prime. The output should look something like:

INPUT 197 -> OUTPUT [971 -> 719 -> 197] - Valid/Invalid

For added complexity, allow the program to accept two numbers and output all the circular primes between them, inclusive. You could choose to format the output for each circular prime just like in the example above. Also you could try to do the cycling part purely mathematically - without converting to a string and slicing it.

Submitted by Lovecraft.

  1. Pseudo-Random Number Generator

    Difficulty: Intermediate

A pseudorandom number generator (PRNG), also known as a deterministic random bit generator (DRBG) is an algorithm for generating a sequence of numbers whose properties approximate the properties of sequences of random numbers. The PRNG-generated sequence is not truly random, because it is completely determined by a relatively small set of initial values, called the PRNG’s seed (which may include truly random values).

Make your own (pseudo) random number generator. Accept input from the user specifying the number of random numbers to generate and the PRNG seed. Output a list of pseudo-random numbers.

For more info » https://en.wikipedia.org/wiki/Pseudorandom_number_generator

Submitted by David Hildebrandt

  1. Friday the 13th

    Difficulty: Intermediate

The user enters a year amd your program should output the number and dates of Friday the 13th in that given year. Try not to rely on any Time library like for example in Ruby — Time() class and make your own methods or functions for that.

To make it more complex, try to input not only the year but any given dates with starting Date(Month, Day, Year) and End Date and ouput if there is an existing one.

For example,

Input: 2017

Output: January 13, 2017 October 13, 2017

Input: 04/14/2017 - 07/14/2018 (mm/dd/yyyy)

Output: October 13, 2017 April 13, 2018 July 13, 2018

Submitted by Jerome

  1. Latin Squares

    Difficulty: Beginner

A Latin square is an n x n array filled with n different symbols each occuring exactly once in each row and exactly once in each column.

For example 1

And, 1 2 2 1

are both valid Latin squares.

For this program you have to check whether a given array is a Latin square. If it is a Latin square, then display true otherwise display false.

The user will provide two inputs:

  1. n - The length of a row in the array
  2. A string representing the array of symbols

Example input

5 1 2 3 4 5 5 1 2 3 4 4 5 1 2 3 3 4 5 1 2 2 3 4 5 1 2 1 3 3 4 4 1 2 3 4 1 3 2 4 2 3 4 1 4 3 2 1

Example output

true false false

  1. Number of Days

    Difficulty: Beginner

Your program should take two string inputs from the user in the format (dd/mm/yyyy) and calculate the number of days between those two dates.

Submitted by Kanishk

  1. UUID

    Difficulty: Intermediate

Make a program that generates a UUID. A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems. Note that your implementation should conform to RFC4122 here > https://tools.ietf.org/html/rfc4122.html

For more information on UUIDs, try > https://en.wikipedia.org/wiki/Universally_unique_identifier

Submitted by Ilya