# Blog

## 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 […]

## 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 […]

## 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 […]

## 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 […]

## 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 […]

## 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 […]

## Display number patterns using java

Here is a list of number patterns that you can produce using any programming language. I use Java in this post. I hope you will find these simple programs useful for programming challenges or assignments you might encounter. You can check also other pattern by clicking here. Here is the first pattern including the full […]

## How to Create a Checkerboard pattern Using Asterisks in Java

Here is a simple program to draw a checkerboard pattern in Java. There can be a different way of doing it. In this case, the program pads every other row with a space to have a zigzag effect. To do that the program checks if the row number is even and if it is, it […]

## How to Create a Hollow Rectangle Using Asterisks in Java

A hollow rectangle such as the box shown below can be drawn by printing the star symbol on only the first and the last row, and the first and the last column. We can fill the rest of the spaces, i.e. from row two up to the (last row – 1) and from column two […]

## Math Worksheets – Multiplication of 2 digits by 2 digits

We have free and printable math worksheets for your kids. All of the worksheets are pdf files to make printing easier. This page includes multiplication of two digits by two digits worksheets. Click any one of the link below to download or print the files : One Two Three Four A sample of the worksheet […]

1 2