public static void main(String[] args) {
Scanner scn = new Scanner (System.in);
int divident = scn.nextInt();
int divisor = scn.nextInt();
int remainder = divident % divisor;
while (remainder!=0)
{
divident = divisor;
divisor = remainder;
}
System.out.println(divisor);
}
can we write while consition as this ,this program is working some tiimes biut not always, really confused on this !!