Runtime error detected

please find the mistake in my code
here is the link attached of my code

Hello @Akshita99,

There are logical issues in your code:
Let’s understand your code:

  1. Following will count the number of digits in e and b
while(m!=0)
{
    m=m/10;
    count++;
}
while(n!=0)
{
    n=n/10;
    c++;
} 
  1. Following will cause run-error
    What is the logic behind it?
while((e/count)==(b/c))
{
    count--;
    c--;
}

Please, explain the logic you are trying to implement.

there I am trying to find first highest initial number.

suppose i have 2 numbers 525 and 543. their 1st digit is same so if i divide them with the no of digits i will get same value. therefore i decremented count and c by 1 and then divided the number again.So i will get 52 and 54. thus it wil first return 543. i made some change in the code in the part you were asking the logic. it is attached here. https://ide.codingblocks.com/s/162744

Hey @Akshita99,

Please justify your statement: “suppose i have 2 numbers 525 and 543. their 1st digit is same so if i divide them with the no of digits i will get same value.” for the example:
595/3=198.33
515/3=171.66

How are they same?

no no, i had changed my code after asking the doubt. here is the link.

https://ide.codingblocks.com/s/162827. i have changed it to 543/(powers of 10) to get initial digit

this is my latest code https://ide.codingblocks.com/s/162854

Hey @Akshita99,

There are still mistakes in the input and output statements of your code.

Also, As you are just comparing the left most digits.
So, your code will fail for the cases like:
1
4
9 97 98 89
Expected Order:
9 98 97 89
Your Code’s format:
98 97 9 89

Solution:
You have to compare all the subsequent digits starting from left to right.