Category Archives: Programming Exercises

Collection of programming Exercises for practice. Logical exercises to improve your programming.

Five exercises on numbers that will help you develop your logic

Five programming exercises with numbers that will help you develop your logic.

Find the largest number from the following series of 7 numbers

In this exercise you have to the find the largest number from the following series

10,12,15,3,5, 22, 2

Hint:

  • Store the numbers in an array
  • Make use of temp variable to store the greater when comparing 2 of them
  • Write a for loop to compare all the other numbers

Continue reading

Greet the guests

In this exercise you have to greet the guests you have invited for your birthday party.

The guest list comprises of men, women, kids (boys and girls)

Your task is load the name of one guest randomly on every page refresh and greet the guests depending on their gender. for eg.

Greet the guests example

  1. Jane Austen is a women, so say Hello Mrs.. Austen
  2. George Orwell is a man, so say Hello Mr. Orwell
  3. Isaac Newton was knighted, so say Hello Sir Newton
  4. Zehen is a boy, so say Hello Master Zehen

Greet the guests hints

  • Create a 2 dimensional array named guest if you are coding in php. The array should store the name and gender.
  • Load one row/record randomly
  • Make use of if else condition to check the gender
  • Alternative you can also make use of switch case of check the gender

Write the code in your favorite programming language.

Greet the guests solutions