У меня волос на голове не осталось)))
Что не так?
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(reader.readLine());
int b = Integer.parseInt(reader.readLine());
if(a>0 && b>0){
a = Math.min(a,b);
b = Math.max(a,b);
for(int nod=a; nod>0; nod--){
if(a%nod==0 && b%nod==0) {System.out.println(nod); break;}
}
} else throw new Exception();
package com.javarush.task.task14.task1420;
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(reader.readLine());
int b = Integer.parseInt(reader.readLine());
if(a>0 && b>0){
a = Math.min(a,b);
b = Math.max(a,b);
for(int nod=a; nod>0; nod--){
if(a%nod==0 && b%nod==0) {System.out.println(nod); break;}
}
} else throw new Exception();
}
}