Java Program to Check for Right Angled Triangle | HackerNoon

United States News News

Java Program to Check for Right Angled Triangle | HackerNoon
United States Latest News,United States Headlines
  • 📰 hackernoon
  • ⏱ Reading Time:
  • 60 sec. here
  • 2 min. at publisher
  • 📊 Quality Score:
  • News: 27%
  • Publisher: 51%

A simple program in Java to check whether a triangle is right-angled or not. - cc: MayankVikash1 java learningtocode

A right-angled triangle is a triangle with one of its interior angles equal to 90 degrees or any one angle is a right angle.

There are several properties of a right-angled triangle; one of them is that the square of the hypotenuse is equal to the sum of the square of the perpendicular and base of a triangle. This is called the Pythagoras Theorem.Fun Fact: Pythagoras’s Theorem was invented in India, long before Pythagoras was even born.

The theorem is mentioned in the Baudhayana Sulba-sutra of India, which was written between 800 and 400 BCE.According to the theorem, the squared of Hypotenuse is equal to the sum of the squared of the other two sides. So, we have to take the input of the two sides of a triangle and a hypotenuse. Calculate the sum of squares of the other two sides and if the sum is equal to the square of the hypotenuse, the triangle is right-angled.import java.

The simple way to check if the squared of the hypotenuse is equal to the sum of the squared of the perpendicular and base is to use if-else.import java.util.*; public class RightAngledTriangle { public static void main { Scanner in=new Scanner; int h, p, b; System.out.println; h=in.nextInt; System.out.println; p=in.nextInt; System.out.println; b=in.nextInt; if +){ System.out.println; } else{ System.out.

We have summarized this news so that you can read it quickly. If you are interested in the news, you can read the full text here. Read more:

hackernoon /  🏆 532. in US

United States Latest News, United States Headlines

Similar News:You can also read news stories similar to this one that we have collected from other news sources.

Cosmological Difficulties of Newton's Theory | HackerNoonCosmological Difficulties of Newton's Theory | HackerNoonRelativity: The Special and General Theory by Albert Einstein is part of HackerNoon’s Book Blog Post series. - science physics
Read more »

Natural Selection | HackerNoonNatural Selection | HackerNoonOn the Origin of Species 1st Edition by Charles Darwin is part of HackerNoon’s Book Blog Post series. - science biology
Read more »

The Solution of the Problem of Gravitation | HackerNoonThe Solution of the Problem of Gravitation | HackerNoonRelativity: The Special and General Theory by Albert Einstein is part of HackerNoon’s Book Blog Post series. - science physics
Read more »



Render Time: 2025-02-25 03:13:28