Computer Science, asked by Anonymous, 1 year ago

✨ Help out please... Write a program in JAVA.. ✨​

Attachments:

Anonymous: ???
Anonymous: Bye.........../!\.........4 ever for u.....

Answers

Answered by nain31
40
 \bold{ABOUT \: JAVA}

Java is a machine independent language which can work on any platform. Its an object oriented programming which stress on object rather than data.

The main parts while doing Java programming are package, Class ,input variables, condition updating.

FUNCTIONS:-

Its a program module used at different instances in a program to perform specific task.

 \bold{ABOUT \: PROGRAM}

◼First we need to check whether the triangle is possible.

◼If triangle is possible than check which triangle it is.

 \huge \boxed{ \bold{CODING}}

import java . io . *;

class triangle

{

public void poss(int p , int q ,int r)

{

int l,m,n:

if(p>q&&p>r)

{

if((p*p = q*q + r*r)=true))

return(1);

}

else if(q>p&&q>r)

{

if((q*q = p*p + r*r)=true))

return(2);

}

else if(r>q&&r>p)

{

if((r*r = q*q + p*p)=true))

return(3);

}

else

return(0);

}

public void decide(int x ,int y ,int z)

{

if(x==b&&y==c)

System . out . println("EQUILATERAL TRIANGLE")

if(x==y||y==z||z==x)

System . out . println("ISOSCELES TRIANGLE")

if(x!=y && y!=z &&z!=x)

System . out . println("SCALENE TRIANGLE")

}

public static void main(String args[])throws Exception

{

int a , b ,c;

DataInputStream in=new DataInputStream(System . in);

a=Interger.parseInt(in . readLine());

b=Interger.parseInt(in . readLine());

c=Interger.parseInt(in . readLine());

triangle obj=new triangle();

s=obj . poss(a,b,c);

if(s==1||s==2||s==3)

obj . decide(a,b,c);

else

System . out . println("Triangle isnt possible");

}

}

 \huge \boxed{ \bold{OUTPUT}}

◼a = 5

b =6

c=9

since c is greater

9 *9 =5 *5 + 6* 6

81 = 25 + 36

81 = 71

Triangle is not possible.

◼a = 5

b = 4

c = 3

Since , a is greater

a*a = b*b + c*c

5 *5 = 4*4 + 3*3

25 = 16 +9

25 = 25

so,

Since , a is neither equal to b and c

SCALENE TRIANGLE

biologyking1977: very very good Nene ✔️
ParamPatel: BIO KING.....WOA
biologyking1977: what
Anonymous: Superb jaan
Similar questions