Advertisement
winone1208

Zad12

Mar 19th, 2021
801
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. package pl.patrykk;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.         System.out.println("Podaj bok a:");
  10.         int a = scanner.nextInt();
  11.         System.out.println("Podaj bok b:");
  12.         int b = scanner.nextInt();
  13.         System.out.println("Podaj bok c:");
  14.         int c = scanner.nextInt();
  15.  
  16.         boolean warunek1 = Math.pow(a,2) + Math.pow(b,2) == Math.pow(c,2);
  17.         boolean warunek2 = Math.pow(a,2) + Math.pow(c,2) == Math.pow(b,2);
  18.         boolean warunek3 = Math.pow(b,2) + Math.pow(c,2) == Math.pow(a,2);
  19.  
  20.  
  21.         if (warunek1 || warunek2 || warunek3){
  22.  
  23.             System.out.println("To jest trójkąt prostokątny");
  24.  
  25.         } else {
  26.  
  27.             System.out.println("To nie jest trójkąt prostokątny");
  28.  
  29.         }
  30.     }
  31.  
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement