while(divident % divisor != 0)
{
int rem = divident % divisor;
divident = divisor;
divisor = rem;
}
System.out.println(divisor);
}
in this code if we wright
import java.util.Scanner;
public class Hcf {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int divisor = scn.nextInt();
int divident = scn.nextInt();
while(divisor<divident)
{
int rem = divident % divisor;
divident = divisor;
divisor = rem;
divident % divisor != 0;
}
System.out.println(divisor);
}
}
in this code it is showing error in the condition line and also if we wright remainder!=0 instead of divident % divisor =0 then also it showing error