Mar 11, 2020 @ 15:05

How to Make a Simple JavaScript Quiz

JavaScript Quiz

In this tutorial, we will develop a simple JavaScript quiz. The system pulls stored array data of English words and their definitions. It then dynamically creates vocabulary questions for every word, followed by multiple-choice. Upon completion of the quiz, the user can submit to see the feedback and the score he or she gets. The index.html file has only a few lines of codes because we create everything dynamically using […]

Read More >>

Dec 7, 2019 @ 13:00

Pure Javascript Calculator

Pure Javascript Calculator

Here is a simple javascript calculator. The calculator handles decimals numbers as well as percents. I believe the source file is well commented so, if you are interested to know how it is made, you can check the js and the CSS file. Click here to see the demo.

Read More >>

Dec 5, 2019 @ 9:39

Javascript Body Mass Index (BMI) Calculator

Body Mass Index Calculator

This simple BMI calculator lets you choose between Metric and imperial system, and it displays the appropriate units of measurement according to the measurement system you selected. You can then, select your height and weight from the dropdown menus provided to check your Body Mass Index. You can see the BMI score displayed on top. If you want the interpretation of the result or you want to know more about […]

Read More >>

Dec 3, 2019 @ 18:02

Running Python from the Git Bash Terminal on Windows

I assume you have installed Git for Windows and want to run python from the terminal but unable to do it. So, if you have the problem of running python from the Git bash terminal, you can fix it using the following steps: Using a text editor in administrative mode, open the ‘aliases.sh‘ file located in your Git folder, most probably in C:\Program Files\Git\etc\profile.d folder. After you opened the file, […]

Read More >>

Feb 3, 2018 @ 16:50

Reading Individual digits of a Number in Java

In this post, I will show two ways of reading individual digits of a number in the Java language. The first method is using String, and it is the easier one. First, we change the input number to string in the following way just as we used previously to find the first digit of a number String strInput = String.valueOf(input); After that, we read each character using the charAt() method. […]

Read More >>

Feb 2, 2018 @ 13:46

Java program to find Sum of Digits in a Number

The following program takes an integer number as an input and returns the sum of the individual digits. The number can be positive or negative. For instance, if the user enters 456, the program returns 15 which is the sum of 4 + 5 + 6. Additionally, the program makes sure the user enters only a valid integer (int) number. The program is listed below: /* This program reads individual […]

Read More >>

Feb 1, 2018 @ 16:30

Java Program to Find Perfect Number

The following Java program displays the available perfect numbers within a defined range of numbers. I use the Java for-loop to iterate between the minimum and maximum numbers to be checked. If a positive integer is equal to the sum of its divisors, we call it a perfect number, assuming the divisors don’t include the number itself. For instance, the factors of 6 are 1, 2 and 3. If we […]

Read More >>

Jan 20, 2018 @ 12:59

How to Check if a Word is a Palindrome in Java

In this post, I will show how to check if a word or sentence is palindrome in Java. If a word or sentence reads the same backwards or forward, we call it palindrome. For instance, if we reverse the word ‘madam’ we get the same word – ‘madam’. Words such as racecar, rotator, tattarrattat, which is also the longest palindrome in the Oxford English Dictionary according to Wikipedia, are palindrome […]

Read More >>

Jan 18, 2018 @ 11:26

Simple Java Program to Find the First and Last Digit of a number

Here is a simple Java program to find the first and the last digit of a given number. Please note if you want the user to supply the number, you need to check for its validity. You also have to make sure the first character is not a minus sign. Otherwise, if the user supplies a negative number, the following line in the program will return the minus (-) sign […]

Read More >>

Jan 17, 2018 @ 11:03

Simple Java program to find Factorial of a number

The Java code below shows how to get the factorial of numbers. For instance 4! = 4 x 3 x 2 x 1 = 24. Since Zero factorial is defined to be one, i.e. 0! = 1, the loop starts from 1. The code below calculates the factorial of numbers from 1 to 10. public class DisplayFactorial{ public static void main(String[] args){ int j = 1; System.out.println(“0! = ” + […]

Read More >>