Python
n=int(input())
if n>1 and n<10 or n==1:
print(1)
elif n>10 and n<100 or n==10 :
print(2)
elif n>100 and n<1000 or n==100 :
print(3)
elif n>1000 and n<10000 or n==1000:
print(4)
elif n>10000 and n<100000 or n==10000:
print(5)
elif n>100000 and n<1000000 or n==100000:
print(6)
elif n>1000000 and n<10000000 or n==1000000:
print(7)
elif n>10000000 and n<100000000 or n==10000000:
print(8)
elif n>100000000 and n<1000000000 or n==100000000:
print(9)
elif n>1000000000 and n<10000000000 or n==1000000000:
print(10)
else:
print(0)
#include <iostream>
using namespace std;
int main(){
int number = 0;
cout << "Enter the month number: ";
cin >> number;
if ((number >= 1) and (number <= 12)){
if (number < 8){
if (number % 2 != 0){
cout << "31 days";
}else if((number % 2 == 0) and (number != 2)){
cout << "30 days";
}else if(number == 2){
cout << "28 days";
}
}else if (number > 7){
}else if(number % 2 == 0){
}else{
cout << "Please enter a valid number";
return 0;
Python
n=int(input())
if n>1 and n<10 or n==1:
print(1)
elif n>10 and n<100 or n==10 :
print(2)
elif n>100 and n<1000 or n==100 :
print(3)
elif n>1000 and n<10000 or n==1000:
print(4)
elif n>10000 and n<100000 or n==10000:
print(5)
elif n>100000 and n<1000000 or n==100000:
print(6)
elif n>1000000 and n<10000000 or n==1000000:
print(7)
elif n>10000000 and n<100000000 or n==10000000:
print(8)
elif n>100000000 and n<1000000000 or n==100000000:
print(9)
elif n>1000000000 and n<10000000000 or n==1000000000:
print(10)
else:
print(0)
СДЕЛАЙ ОТВЕТ ЛУЧШИМ!#include <iostream>
using namespace std;
int main(){
int number = 0;
cout << "Enter the month number: ";
cin >> number;
if ((number >= 1) and (number <= 12)){
if (number < 8){
if (number % 2 != 0){
cout << "31 days";
}else if((number % 2 == 0) and (number != 2)){
cout << "30 days";
}else if(number == 2){
cout << "28 days";
}
}else if (number > 7){
if (number % 2 != 0){
cout << "30 days";
}else if(number % 2 == 0){
cout << "31 days";
}
}
}else{
cout << "Please enter a valid number";
}
return 0;
}