Witam, chcę aby program pobierał 3 liczby i sprawdzał czy trójkąt jest prostokątny, pomożecie ?
import java.io.*;
class troj
{
public static void main(String args[]) throws IOException
{
int a1,b1,c1;
String a,b,c;
BufferedReader x= new BufferedReader(new InputStreamReader(System.in));
a=x.readLine();
b=x.readLine();
c=x.readLine();
a1=Integer.parseInt(a);
b1=Integer.parseInt(b);
c1=Integer.parseInt(c);
if (a*a + b*b == c*c)
System.out.print("To jest trojkat prostokatny");
else
System.out.print("To nie jest trojkat prostokatny");
}
}
błąd
Main.java:17: error: bad operand types for binary operator '*'
if (a*a + b*b = c*c)
^
first type: String
second type: String
Main.java:17: error: bad operand types for binary operator '*'
if (a*a + b*b = c*c)
^
first type: String
second type: String
Main.java:17: error: bad operand types for binary operator '*'
if (a*a + b*b = c*c)
^
first type: String
second type: String
3 errors
dodanie znacznika <code> - Furious Programming