Example Program to generate random numbers In the below program, we are using the nextInt() method of Random class to serve our purpose. /* Program:… [Read More]
Java program to perform binary search – Example
Example Program to perform binary search on a list of integer numbers This program uses binary search algorithm to search an element in given list… [Read More]
Java program for linear search – Example
Example Program: This program uses linear search algorithm to find out a number among all other numbers entered by user. /* Program: Linear Search Example… [Read More]
Java program to print Floyd’s triangle – Example
Example Program: This program will prompt user for number of rows and based on the input, it would print the Floyd’s triangle having the same… [Read More]
Java Program to Check Whether a Number is Even or Odd
In this article, we will write two java programs to check whether a number is even or odd. If a number is perfectly divisible by… [Read More]
Java Program to display first n or first 100 prime numbers
Program to display first n prime numbers import java.util.Scanner; class PrimeNumberDemo { public static void main(String args[]) { int n; int status = 1; int… [Read More]
Java program to display prime numbers from 1 to 100 and 1 to n
The number which is only divisible by itself and 1 is known as prime number. For example 2, 3, 5, 7…are prime numbers. Here we… [Read More]
Java program to check prime number
The number which is only divisible by itself and 1 is known as prime number, for example 7 is a prime number because it is… [Read More]
java program to check palindrome string using recursion
Program: Check whether String is palindrome using recursion package beginnersbook.com; import java.util.Scanner; class PalindromeCheck { //My Method to check public static boolean isPal(String s) {… [Read More]
Java Program to check Palindrome string using Stack and Queue
In this tutorial, you will learn how to write a java program check whether the given String is Palindrome or not. There are following three… [Read More]
java program to find factorial of a given number using recursion
Here we will write programs to find out the factorial of a number using recursion. Program 1: Program will prompt user for the input number…. [Read More]
Java program to sum the elements of an array
In this tutorial we will see how to sum up all the elements of an array. Program 1: No user interaction /** * @author: BeginnersBook.com… [Read More]
Java Program to Calculate Area of Rectangle
In this tutorial we will see how to calculate Area of Rectangle. Program 1: User would provide the length and width values during execution of… [Read More]
Java program to calculate area of Square
In this tutorial we will learn how to calculate area of Square. Following are the two ways to do it: 1) Program 1: Prompting user… [Read More]
Java program to calculate area of Triangle
Here we will see how to calculate area of triangle. We will see two following programs to do this: 1) Program 1: Prompt user for… [Read More]
- « Previous Page
- 1
- …
- 6
- 7
- 8
- 9
- Next Page »