### My issue

### My code

```
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while (t--)
{
int n;
cin>>n;
int y=n/10;
int u=n/100;
int o=n/1000;
if (y==0){cout<<"1";}
else if (u==0 && y!=0){cout<<"2";}
else if (o==0&& u!=0){cout<<"3";}
else if (o !=0){cout<<"more than 3";}
cout<<endl;
}
return 0;
}
```

Problem Link: HOWMANY Problem - CodeChef

@sakshammaitri

The given problem can simply solved by providing the right conditionals.

Here the logic I use to solve it was like this;

If a number is a single digit number, it would be lower than smallest 2-digit number,*(10)*.

In the same way, for a number to be 2-ditgit one, it will be lower than smallest 3-digit number,*(100)*.

For a number to be 3-digit one, it needs to be smaller than smallest 4-digit number, *(1000)*.

For any number not falling in any of above categories, it will be in **More than 3 digit number**.

Here is my code for reference.

```
# cook your dish here
n=int(input())
if(n<10):
print('1')
elif(n<100):
print('2')
elif(n<1000):
print('3')
else:
print('More than 3 digits')
```

1 Like

Thank You for your help : D