# Java Programming Examples on Mathematical Functions

Here is the listing of Java programming examples on Mathematical Functions:

## 1. Java Examples on Mathematical Calculations

This section contains Java programs to find simple interest and roots of quadratic equation.

Java Program to Find the Simple Interest Java Program to Find the Roots of Quadratic Equation |

## 2. Java Examples on Special Numbers

Armstrong number is an integer such that the sum of the cubes of its digits is equal to the number itself. The Java programs in this section provides a list of Java numbers used to display these special numbers and also perform various operations on these numbers. These operations include printing armstrong number from 1 to 1000, checks whether given number is perfect number or not, finding sum of natural numbers using while loop, print the next 20 leap years, checks whether given number is armstrong number or not and prints the first twenty perfect squares.

Java Program to Print Armstrong Number from 1 to 1000 Java Program to Check if a Given Number is Perfect Number Java Program to Check If a Given Number is ArmStrong Number Java Program to Check if a Given Number is Prime Number Java Program to Find Sum of Natural Numbers Using While Loop Java Program to Calculate the Sum, Multiplication, Division and Subtraction of Two Numbers Java Program to Print the Next 20 Leap Years Java Program to Print the First Twenty Perfect Squares Java Program to Input a String with at least One Number, Print the Square of all the Numbers in a String |

## 3. Java Examples on Fibonacci and Complex Numbers

Fibonacci sequence is a series where a number is found by adding up the two numbers before it. This section contains Java programs to generate fibonacci numbers, performs addition of two complex numbers and computes the list of first 100 fibonacci numbers.

Java Program to Generate Fibonacci Numbers Java Program to Add two Complex Numbers Java Program to Compute List of First 100 Fibonacci Numbers |

## 4. Java Examples on Finding the Area, Volume and Surface Area of Geometrical Figures

Trapezium is a quadrilateral that has one pair of parallel sides. Parallelogram is a quadrilateral that has two pairs of parallel sides. Rhombus is a flat shape with 4 equal straight sides. cuboid is a box-shaped solid object which has six flat sides. Sphere is a round geometrical object in three-dimensional space. Cone is a rotated triangle. The Java programs in this section calculates the area of a Trapezium, rhombus and parallelogram, volume and surface area of cone, sphere and cuboids, calculates the displayed area of a circle, finds the perimeter of triangle. circle and rectangle. This section contains Java programs on finding the volume of union, area of circle using radius and area of square, rectangle and circle using method overloading.

## 5. Java Examples on Recursion

Recursion occurs when a thing is defined in terms of itself or of its type. Recursion is the attribute that allows a method to call itself. A method that calls itself is said to be recursive. The Java programs in this section deals with recursion. These programs include finding factorial value with or without using recursion, convert a number decimal system to binary system using recursion, finds natural numbers using recursion and also finds a given number is prime or not by using recursion.

## 6. Java Examples on Number Conversion

This section contains Java programs on number conversions like converting binary to octal, binary to hexadecimal, octal to binary, hexadecimal to binary, octal to decimal, binary number to equivalent decimal, hex to decimal, decimal to binary, decimal to octal, decimal to hexadecimal, fahrenheit to celsius. This section also contains programs on numbers to roman numbers and roman numbers to decimal numbers.

Java Program to Convert Binary to Octal Java Program to Convert Binary to Hexadecimal Java Program to Convert Octal to Binary Java Program to Convert Hexadecimal to Binary Java Program to Convert Octal to Decimal Java Program to Convert the Given Binary Number into its Equivalent Decimal Java Program to Convert a Decimal Number to Binary & Count the Number of 1s Java Program to Convert Hex to Decimal Java Program to Convert Decimal to Binary, Octal and Hexadecimal Number Java Program to Convert Fahrenheit into Celsius Java Program to Convert the Given Binary Number into Decimal Java Program to Convert Numbers to Roman Numerals Java Program to Convert Roman to Decimal Number |

## 7. Java Examples on Implementation of Floyd and Pascal’s Triangle

Floyd’s triangle algorithm is a right-angled triangular array of natural numbers. It is defined by filling the rows of the triangle with consecutive numbers. Pascal triangle is a triangular array of the binomial coefficients. pow() function takes two arguments and returns the power raised to the base number. This section contains Java programs on pow() function, displaying floyd’s and pascal triangles.

Java Program to Display Floyd’s Triangle Java Program to Display Pascal Triangle Java Program to Perform Pow () Function |

## 8. Java Examples on Summation of a Series and GCD

Euclid’s algorithm is an efficient way to find GCD of two numbers. GCD of two integers is the largest integer that can exactly divide both numbers. This section contains Java programs to find the gcd and lcm of two numbers using euclids algorithm, finds prime number within a range of n1 and n2, finds sum of series, computes gcd and generate harmonic series.

## 9. Java Examples to display Special Patterns

This section contains Java programs on special patterns like displaying diamond pattern by using while and for loops, displays star in a triangular form, prints the multiplication table in triangle form and draws the shapes like oval, lines and rectangle using graphics method.

Java Program to Print Diamond Pattern Java Program to Display Stars in a Triangular Form Java Program to Print the Multiplication Table in a Triangle Form Java Program to Draw the Line, Rectangle, Oval, Text Using the Graphics Method |