how to find the largest among single digit code example
Example: 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;
}
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;
}