+ 3
*[Code challenge]* find the second largest digit in a given number without using arrays and string operation
find the second largest digit in a given number without using arrays and string operation
5 Réponses
+ 13
c#
int n= 4719;
int max=0, x=0, secondhighestnum =0;
while(n>0)
{
x=n%10;
if(x>max)
{
max =x;
}
if(x > secondhighestnum && x < max)
{
secondhighestnum = x;
}
n= n/10;
}
Console.WriteLine(secondhighestnum);
+ 4
u shouldn't use arrays @luka
+ 3
I used LiknedList to store the data...
https://code.sololearn.com/c4LAen7h0zeU/?ref=app
+ 2
i want code .
0
It can be implemented by using while loop and storing the reminders in a variable