Power Function in Java

This is the Java Program to Implement the pow() Function. Problem Description Given a value say x, and an exponent n, write a program to calculate x raised to the power n. Problem Solution The value x raised to the power n can be calculated, using a simple recursive algorithm. If the exponent is 1 … Read more

advertisement

Java Program to Find the Sum of n Cube Numbers

This is the Java Program to Find the Sum of n Cube Numbers. Problem Description Given an integer says n, find out the sum of the first n cubed numbers. Problem Solution The sum of the first n cubed numbers can be calculated using the formula : sum = (n*(n+1)/2)2 Program/Source Code Here is the … Read more

advertisement

Java Program to Find the Sum of n Square Numbers

This is the Java Program to Find the Sum of n Square Numbers. Problem Description Given an integer says n, find out the sum of the first n squared numbers. Problem Solution The sum of the first n squared numbers can be calculated using the formula : sum = n*(n+1)*(2n+1)/6 Program/Source Code Here is the … Read more

advertisement

Java Program to Print the First n Square Numbers

This is the Java Program to Print the First n square Numbers. Problem Description Given an integer says n, write a java program to print the first n squared numbers. Problem Solution Iterate through the loop from 1 to n and print the square of the loop variable. Program/Source Code Here is the source code … Read more

advertisement

Java Program to Implement the cos() Function

This is the Java Program to Implement the cos() Function (approximately). Problem Description Given an angle say x, in degrees find out the cosine of the angle approximately. Problem Solution The cosine of an angle x can be calculated using the following equation cos x = 1 – (x2)/2! + (x4)/4! – (x6)/6! + ….. … Read more

advertisement

Java Program to Implement the sin() Function

This is the Java Program to Implement the sin() Function (approximately). Problem Description Given an angle say x, in degrees find out the sine of the angle approximately. Problem Solution The sine of an angle x can be calculated using the following equation sin x = x – (x3)/3! + (x5)/5! – (x7)/7! + ….. … Read more

advertisement

Java Program to Print the Multiplication Table in a Triangle Form

This is the Java Program to Print the Multiplication Table in Triangular Form. Problem Description Write a Java Program to Print the Multiplication Table in Triangular Form. In this form, a table is displayed row and column wise, in such a way such that in every row, only the entries up to the same column … Read more

advertisement

Pyramid Program in Java

This is the Java Program to Print 1,2,3,4…in Triangular Pattern. Problem Description Write a Java Program to print the values 1,2,3,4.. in a triangular pattern, upto n lines. Problem Solution The idea is to use nested loops. Iterate the first loop from 1 to n. Print the required number of spaces using a nested loop … Read more

advertisement

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 factorial of the reciprocal of the loop variable to the sum. The … Read more

advertisement

Java Program to Find the Sum of the Series 1/1+1/4+1/9+…1/N^2

This is the Java Program to Find the Sum of the Series 1/1+1/4+1/9+…1/N2. Problem Description Given a number n, write a java program to find the sum of the series 1/1+1/4+1/9+…1/N2. Problem Solution Start a loop from 1 to n, and add the square of the reciprocal of the loop variable to the sum. Program/Source … 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.