Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- package smiesznanazwa;
- public class Smiesznanazwa
- {
- public static void main(String[] args)
- {
- Scanner S = new Scanner(System.in);
- int liczba1 = S.nextInt();
- if(liczba1 <= 0)
- {
- System.out.println("Wprowadzona liczba musi byc dodatnia, sprobuj jeszcze raz :)");
- liczba1 = S.nextInt();
- }
- int liczba2 = S.nextInt();
- if(liczba2 <= 0)
- {
- System.out.println("Wprowadzona liczba musi byc dodatnia, sprobuj jeszcze raz :)");
- liczba2 = S.nextInt();
- }
- System.out.println("Wprowadzone liczby: "+liczba1+", "+liczba2);
- if(liczba1 < liczba2)
- {
- if(liczba2 % liczba1 == 0)
- {
- System.out.println("Pierwsza liczba jest dzielnikiem drugiej");
- }
- } else if(liczba2 < liczba1) {
- if(liczba1 % liczba2 == 0)
- {
- System.out.println("Druga liczba jest dzielnikiem pierwszej");
- };
- } else if(liczba1 == liczba2) {
- System.out.println("Liczby sa takie same, wiec sa swoimi dzielnikami");
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement