Maths and Number Puzzles


Write a program that asks the user for a number n and prints the sum of the numbers 1 to n


Write a program that asks the user for a number n and gives him the possibility to choose between computing the sum and computing the product of 1,…,n.


Write a program that given a number n produces the times table for that number. Modify the previous program such that only multiples of three and five are considered in the sum, e.g. 3, 5, 9, 15 for n=17


Write a program that prints all prime numbers.


Write a program that calculates the first 20 Triangle Numbers using Gauss’ Equation which says that to calculate the nth triangle number. triangleNumber-300x33 Can you create a visually output?  This could be either ASCII art or via a GUI.  

About CDB 362 Articles
Self-Employed Software Developer, Spark, Property Management, Hobby Forestry, Ex-Teacher, Engineering - Wood, Metal, Electrics & Computers. Outdoors - Walk, Cycle, Kitesurf,

Be the first to comment

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.