answersLogoWhite

0

let s1,s2,s3 be three sides of a triangle.

import java.lang.*;

import java.io.*;

import java.util.*;

class Triangle

{

public static void main(String args[])

{

boolean test=false;

int s1,s2,s3;

Scanner input = new Scanner(System.in);

System.out.println("enter the side1 of triangle");

s1=input.nextInt();

System.out.println("enter the side2 of triangle");

s2=input.nextInt();

System.out.println("enter the side3 of triangle");

s3=input.nextInt();

if((s1*s1)==(s2*s2)+(s3*s3))

{

test=true;

}

else if((s2*s2)==(s1*s1)+(s3*s3))

{

test=true;

}

else if((s3*s3)==(s1*s1)+(s2*s2))

{

test=true;

}

if(test==true)

System.out.println("Entered sides form a right angle triangle.....");

else

System.out.println("Entered sides dosn't form a right angle triangle.....");

}

}

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine
SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve
RossRoss
Every question is just a happy little opportunity.
Chat with Ross

Add your answer:

Earn +20 pts
Q: Write a program to print a right angle triangle containing digit in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp