Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

find largest digit in a number

int n, r, l = 0; //n=num, r= reminder , l= largest.
// this is the logic code only.
while (n>0)
{
r = n % 10;
if(l<r) {
l = r;
}
n = n / 10;
}
 
PREVIOUS NEXT
Tagged: #find #largest #digit #number
ADD COMMENT
Topic
Name
2+5 =