program to find greatest digit of a number(using java)

 

// a=125  ans-5

class greatest

{

public static void main(String args[])

{

int  no=125, great=0,b=0;

while(no>0)

{

b=n0%10;

no=no/10;

if(b>great)

great=b;

}

System.out.println(great);

}

}

Comments

Popular posts from this blog