daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2. public class DelitelNasobek {
  3. static Scanner sc = new Scanner(System.in);
  4. public static void main(String[] args) {
  5.     boolean ok = true;
  6.     do{
  7.     int number = sc.nextInt();
  8.     if(number>0){
  9.         int number2 = sc.nextInt();
  10.         int min=number, max=number2;
  11.     if(number>number2){
  12.         max=number;
  13.         min=number2;
  14.     }
  15.     for (long i = min; i >= 1; i--) {
  16.         if(number%i==0 && number2%i==0){
  17.             System.out.print(i + " ");
  18.             break;
  19.         }
  20.     }
  21.     for (long i = max; i <=min*max ; i+=max) {
  22.         if(i%number==0 && i%number2==0){
  23.             System.out.print(i);
  24.             break;
  25.         }
  26.     }
  27.         System.out.println("");
  28.     }else ok = false;
  29.     }while(ok);
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top