Zadanie 1
Program można uruchomić za pomocą polecenia: java Main 6
This commit is contained in:
parent
16f4649ea6
commit
c9e9b68a89
BIN
zad1/Main.class
Normal file
BIN
zad1/Main.class
Normal file
Binary file not shown.
18
zad1/Main.java
Normal file
18
zad1/Main.java
Normal file
@ -0,0 +1,18 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
int n;
|
||||
if(args.length == 0) {
|
||||
System.out.println("Proszę podać n ");
|
||||
Scanner scan = new Scanner(System.in);
|
||||
n = scan.nextInt();
|
||||
}
|
||||
else{
|
||||
n = Integer.parseInt(args[0]);
|
||||
}
|
||||
Ring ring = new Ring(n);
|
||||
System.out.println(ring.findRingDetails());
|
||||
}
|
||||
}
|
BIN
zad1/NWDCalculator.class
Normal file
BIN
zad1/NWDCalculator.class
Normal file
Binary file not shown.
9
zad1/NWDCalculator.java
Normal file
9
zad1/NWDCalculator.java
Normal file
@ -0,0 +1,9 @@
|
||||
public class NWDCalculator {
|
||||
public static int findNWD(int a, int b) {
|
||||
if (b == 0)
|
||||
return a;
|
||||
else {
|
||||
return findNWD(b, a % b);
|
||||
}
|
||||
}
|
||||
}
|
BIN
zad1/Ring.class
Normal file
BIN
zad1/Ring.class
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user