Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package zestaw;
- import java.util.Scanner;
- /**
- *
- * @author student
- */
- public class Zestaw {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- Scanner skaner = new Scanner(System.in);
- System.out.println("LiczbaA = ");
- double LiczbaA = skaner.nextDouble();
- System.out.println("LiczbaB = ");
- double LiczbaB = skaner.nextDouble();
- double sa = (LiczbaA+LiczbaB)/2;
- double sg = Math.sqrt(LiczbaA * LiczbaB);
- double shOdw = 1/LiczbaA + 1/LiczbaB;
- double sh = 1/shOdw;
- System.out.println("arytmetyczna: " + sa + " geometryczna: " + sg + " harmoniczna: " + sh );
- }
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package zestaw;
- import java.util.Scanner;
- /**
- *
- * @author student
- */
- public class Zestaw {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- Scanner skaner = new Scanner(System.in);
- System.out.print("BokA = ");
- int BokA = skaner.nextInt();
- System.out.print("BokB = ");
- int BokB = skaner.nextInt();
- System.out.print("BokC = ");
- int BokC = skaner.nextInt();
- if (BokA + BokB < BokC) {
- System.out.println("Nie mozna zbudowac trojkata");
- } else if (BokB + BokC < BokA) {
- System.out.println("Nie mozna zbudowac trojkata");
- } else if (BokA + BokC < BokB) {
- System.out.println("Nie mozna zbudowac trojkata");
- } else {
- System.out.println("Mozna zbudowac Trojkat");
- }
- }
- }
- //& - sprawdza wszystkie warunki nawet jesli warunek po lewej przyjmuje false
- //&& - jesli warunek po lewej przyjmuje false, warunek po prawej nie jest sprawdzany
- //alt + shift + f //Automatyczne formatowanie kodu
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement