Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //zadanie 1a
- /// --- MAIN ---///
- import java.io.IOException;
- import zadanie1a.punktA;
- import zadanie1a.punktB;
- import zadanie1a.punktC;
- public class Pwzstar {
- public static void main(String[] args) throws IOException {
- punktA.read();
- //punktB.read();
- //punktC.read();
- }
- }
- /// --- Punkt A---///
- import java.io.*;
- public class punktA {
- public static void read() throws IOException{
- BufferedReader in = new BufferedReader(new InputStreamReader(System.in),1);
- System.out.print("Podaj Argumenty :");
- System.out.println(in.readLine());
- }
- }
- /// --- Punkt B---///
- import java.io.*;
- public class punktB {
- static int a, b;
- static BufferedReader in = new BufferedReader(new InputStreamReader(System.in), 1);
- public static void read() throws IOException {
- a = scan("A");
- b = scan("B");
- System.out.println(nwd(a, b));
- }
- private static int scan(String v) throws IOException {
- int x;
- System.out.print("Podaj " + v + ":");
- x = Integer.parseInt(in.readLine());
- return x;
- }
- private static String nwd(int a, int b) {
- while (a != b){
- if (a > b){
- a = a - b;
- } else {
- b = b - a;
- }
- }
- return "NWD: " + a;
- }
- }
- /// --- Punkt C -not finished---///
- import java.io.*;
- public class punktC {
- static BufferedReader in = new BufferedReader(new InputStreamReader(System.in), 1);
- static float x;
- public static void read() throws IOException{
- x = scan("a");
- if(x%1 == 0)
- {
- System.out.println("Work");
- }
- else{
- System.out.println("Podana liczba nie jest całkowita");
- }
- }
- private static float scan(String v) throws IOException {
- float x;
- System.out.print("Podaj " + v + ":");
- x = Float.parseFloat(in.readLine());
- return x;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement