Computer Science, asked by Krithivarsha, 9 months ago

write a python program which accepts an integer and checks if its a 3 digit number or not.

Answers

Answered by vidushisinghania123
2

Answer:

class Integer

{

// function to check whether the

// integer is a three digit no. or not

void displayInteger ( int integer )

{

if ( integer < 99 && integer >=

999 )

{

System.out.println( integer + "

is a three digit number ");

}

else

{

System.out.println( integer +

" is not a three digit number ");

}

}

}

Answered by Equestriadash
6

The following codes must be typed in script mode, saved and then executed.

Here, we'll be using the IF - ELSE function. It is a function that decides the result based on a given condition.

It will run the body of the code, only if the condition is true. Otherwise, the 'else' code of the value inputted will be executed.

CODE:

num = input("Enter a number:")

if len(num)== 3:

   print("The number entered has 3 digits.")

else:

   print("The number entered isn't of 3 digits.")

OUTPUT:

Attachments:
Similar questions