Category: Maths

0

Find the roots of Quadratic Equation – Java Program

Quadratic equation is in the form = ax2 + bx + c Discriminant (d) = b2 – 4ac Then roots are calculates using the equations below Root_1 =  (-b + √d)/2a Root_2 =  (-b...

0

Find the Area and Perimeter of Rectangle – Java Program

A rectangle is a quadrilateral with four right angles. Say rectangle is given with side’s length A and B Area of Rectangle = A * B Perimeter of rectangle = 2(A+B) Code: Run This Code Output: Area of Rectangle:...

0

Calculate Log2n without using built-in function

Objective: Given a number n, write a program to calculate Log2n without using built-in function. Example: N = 32 Log232 = 5 N = 64 Log264 = 6 Approach: Initialize result = 0. Keep...

0

Floyd’s Triangle – Java Implementation

Floyd’s Triangle: Floyd’s triangle is a right angled triangular array of natural numbers. It named after Robert Floyd. Rows of the triangle filled by consecutive numbers. First row will have single number which is...

0

Java Program to determine if Given Year is Leap Year

Objective: Given a Year, write a java program to find whether year is leap year or not. Leap Year: a year, usually occurring once every four years, that has 366 days including February 29...

2

Find the Area of a Circle – Java Program

Area of a circle = πR2 Where π = 3.14 and R = radius of circle Example: Radius = 4.0 Area = π*radius*radius = 3.14*4*4 = 50.24 Code:Run This Code Output: Area of circle...

1

Find the Area of a Triangle Using coordinates

Objective – Given three vertices coordinates or (X, Y) coordinates, write a program to find the area of a triangle. Example: Approach: Given the coordinates of the three vertices of any triangle are (X1,...

%d bloggers like this: