calculate HCF

 class hcf

{

public static void main(String args[])

{

int  a=10,b=12,HCF=0;

for(int i=1; i<=Math.min(a,b) ; i++)

{

if(a%i==0 && b%i==0)

HCF=i

}


System.out.println(HCF);

}}

Comments

Popular posts from this blog