Im sorry if i shouldnt post C related stuff here, I dont like stack overflow so i wanted to try my luck here.

Anyways, I am soposed to return an integer with 1 deleted digit so that i get the maximum possible number.

Its specified that 10 <= n <= 1000000

Examples

input 134 output 34 exp: removed 1, 34 is left, removing 3 would output 14, removing 4 would output 13 34 > 14 > 13.

input 1001 output 101 …

My code so far:

```
#include <math.h>
#include <stdbool.h>
int deleteDigit(int n) {
char number[7];
int lenght = log10(n) + 1; //For any positive integer nn, the number of digits in n is log(base10)n +1
int result,i,j = 0;
bool hasZero = false;
sprintf(number, "%d", n);
while(hasZero == false || j < lenght)
if(number[j++] == '0') hasZero = true;
j--;
if(!hasZero)
for(i = 1; i<lenght;i++)
{
result += number[i] - '0';
result *= 10;
} else if (hasZero)
for(i = 0; i<lenght;i++)
{
if(i == j) i++;
result += number[i] - '0';
result *= 10;
}
return result/10;
}
```