Computer Science, asked by ItsVarunxD, 6 months ago

Write a program to input a number and
count the number of digits. The program
further check whether it contains odd
number of digit or even.

Answers

Answered by valeriy69
1

\small\mathsf\color{pink}{Solution\: using\: python\: 3}

n = int(input("number: "))

l = len(str(n))

print(f"no of digits: {l}")

if l % 2 == 0:

print("digits are even")

else:

print("digits are odd")

\small\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Answered by anindyaadhikari13
1

Question:-

➡ Write a program to input a number and count the number of digits. The program further checks whether it contains off number of digit of even.

Program:-

This is written in Python. Its the easiest approach.

n=int(input("Enter the number: "))

x=len(str(n))

print("Number of digits: ",x)

if x%2==0:

print("Even number of digits.")

else:

print("Odd number of digits.")

Similar questions