enter the sides of a triangle and check whether the triangle is possible or not using I/O statement
Answers
Answered by
3
import java.io.*;
class triangle
{
public static void main (String args[]) throws IOException
{
InputStreamReader read = new Inputstreamreader (System.in);
BufferedReader read = new BufferedReader (read);
System.out.println (" Enter the sides of a triangle");
int a,b,c;
a = Integer.parseInteger(in.readline);
b = Integer.parseInteger(in.readline);
c= Integer.parseInteger(in.readline);
if ((a+b>c)&&(b+c>a)&&(c+a>b))
System.out.println("Triangle is possible");
else
System.out.println("Triangle is not possible");
}
}
class triangle
{
public static void main (String args[]) throws IOException
{
InputStreamReader read = new Inputstreamreader (System.in);
BufferedReader read = new BufferedReader (read);
System.out.println (" Enter the sides of a triangle");
int a,b,c;
a = Integer.parseInteger(in.readline);
b = Integer.parseInteger(in.readline);
c= Integer.parseInteger(in.readline);
if ((a+b>c)&&(b+c>a)&&(c+a>b))
System.out.println("Triangle is possible");
else
System.out.println("Triangle is not possible");
}
}
Similar questions
Math,
7 months ago
English,
7 months ago
CBSE BOARD X,
1 year ago
Geography,
1 year ago
English,
1 year ago