Java Program to Find the Sum of the Series 1/1+1/2+1/3+…1/N

This is the Java Program to Find the Sum of the Series 1/1+1/2+1/3+…1/N. Problem Description Given a number n, write a java program to find the sum of the series 1/1+1/2+1/3+…1/N. Problem Solution Start a loop from 1 to n, and add the reciprocal of the loop variable to the sum. Program/Source Code Here is … Read more

advertisement

Java Program to find GCD and LCM of Two Numbers Using Euclid’s Algorithm

This is a Java Program to find GCD and LCM of Two Numbers Using Euclid’s Algorithm. Euclid’s Algorithmis an algorithm, a step-by-step procedure for performing a calculation according to well-defined rules, and is one of the oldest numerical algorithms in common use. We divide the two numbers entered by the user and remainder become divisor … Read more

advertisement

Java Program to Generate Harmonic Series

This is a Java Program to Generate Harmonic Series. We take a number as an input and using loops we generate the Harmonic series and get the desired output. Here is the source code of the Java Program to Generate Harmonic Series. The Java program is successfully compiled and run on a Windows system. The … Read more

advertisement

Java Program to Print Floyd’s Triangle

Floyd’s triangle in Java is a right-angled triangular pattern of numbers in Java, where the numbers from 1 to n are arranged in rows, starting from 1, then 2, and so on. In Java, Floyd’s triangle can be created using nested loops to print the numbers in the correct pattern. The outer loop controls the … Read more

advertisement

Java Program to Print Pascal’s Triangle

Pascal triangle in Java is a matrix of the binomial coefficients. The number of entries in every row increases by 1 starting from the first row having 1 entry and the second row having 2 entries and so on. Example: 1 ————-> Top of the triangle   1 1 \+/ 1 2 1 \+/ \+/ … Read more

advertisement

Java Program to Add Two Complex Numbers

This is the Java Program to Add Two Complex Numbers. Problem Description Given two complex numbers, write a java program to add the two numbers. Problem Solution Add the real and imaginary parts of the numbers seperately and store them in a new variable. Program/Source Code Here is the source code of the Java Program … Read more

advertisement

Java Program to Find the Area of Trapezium

This is the Java Program to Find the Area of a Trapezium. Problem Description Given the dimensions of a trapezium, find out its area. Problem Solution The area of a trapezium can be calculated using the formula: Area = (sum of parallel sides)*(height)/2. Program/Source Code Here is the source code of the Java Program to … Read more

advertisement

Java Program to Find the Area of Rhombus

This is the Java Program to Find the Area of a Rhombus. Problem Description Given the dimensions of a rhombus, find out its area. Problem Solution The area of a rhombus can be calculated using the formula: Area = (diagonal1)*(diagonal2)/2. Program/Source Code Here is the source code of the Java Program to Find the Area … Read more

advertisement

Java Program to Find Sum of the Series 1/1! + 2/2! + 3/3! + ……1/N!

This is a Java Program to Find Sum of the Series 1/1! + 2/2! + 3/3! + …N/N!. Enter the number of terms you want in the series as input. Now we use loops and factorials to calculate the sum and get the desired result. Here is the source code of the Java Program to … Read more

advertisement

GCD Program in Java

This is a Java Program to Compute GCD. Greatest Common Divisor of a given set of numbers is the highest number which divides exactly every number of the given set. Enter the two numbers as input. Now we use loops to find GCD of two given numbers. Here is the source code of the Java … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.