Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Given three sides of a triangle. Write the Program to
determine whether the triangle is :
1) Invalid
2) Right Angled
3) Isoscales
4) Equilateral
5) Not Special

An Isoscales right angled triangle should be taken as a
Right Angled Triangle

Answer Posted / ganesh bhat

I believe, this is more efficient one. solves all the cases.. comments please. Written in java

public static Map validateTriange(int a,int b,int c)
{
Map props = new HashMap();
boolean isValidTriangle;

int bigSide = a;
if(bigSide<b){bigSide = b;}
if(bigSide<c){bigSide = c;}

boolean isSpecial = false;

if((a+b+c-bigSide)>bigSide)
{
props.put("VALID","YES");
}
else
{
props.put("VALID","NO");
return props;
}

if(a == b||b==c||c == a)
{
props.put("ISOSCELES","YES");
isSpecial = true;
}

if(a == b && b == c)
{
props.put("EQUALATERAL","YES");
isSpecial = true;
}


if(((a*a+b*b+c*c)-bigSide*bigSide) == bigSide*bigSide)
{
props.put("RIGHT_ANGLED","YES");
isSpecial = true;
}

return props;
}

Is This Answer Correct ?    22 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is log files in qtp what is use

1981


in a VB application, where the data will be stored after manipulation? what is the syntax for that?

2220


which book we learned this mantis? how many version are realsed this mantis upto now?

1895


how to convert hashmap to arraylist with iteration

1819


how to add Servlet-api.jar file into eclipse 3.3.2 ?

4514


You are given a dictionary of all valid words. You have the following 3 operations permitted on a word: delete a character, insert a character, replace a character. Now given two words - word1 and word2 - find the minimum number of steps required to convert word1 to word2. (one operation counts as 1 step.)

1021


How does the type system works when there is interoperability between a COM and .Net, i mean what exactly happens there

2008


could u please also write an example of a code that involves instances from an abstract class just as u did for interfaces because u said it could also work which i really doubt. thanks

2048


how to stop execution of step 3 in a job mainframe

2088


How to get the index of the clicked field in reports in ABAP?

1635


What is the difference between CLEAR & RESET and OPEN & CLOSE OPCOEDS(USING RPG/400).wheare we can use this?can any body tell me in real time senario with example please?

2040


what are the things i had to say in personal introduction in hr round mail me to prasanna.1867@rediff.com

2073


How to print No.of.rows affected after updation using ADO.Net

2833


WHAT IS MAIN IMPORTANT THING IN SOFTWARE?

2226


Can anyone send me NIC question papers alongwith answers on nidhi1485@yahoo.co.in? Urgently needed.. Thanks in advance

2325