Unit Digit from 1 to 5

 Coding Problem Keys 

 Unit Digit from 1 to 5 

 Problem Statement 

Given an integer N as input, the program must print YES if the unit digit is from 1 to 5. Else the program must print NO.

 Boundary Condition(s) 

1 <= N <= 999999

 Input Format 

The first line contains the value of N.

 Output Format 

The first line contains YES or NO.

 Example Input/Output 1 

 Input 

12345

 Output 

YES

 Example Input/Output 2 

 Input 

1248

 Output 

NO

 Max Execution Time Limit: 5000 millisecs 

 Solution 

 Programming Language: Python 3 Language 

a=input().strip()
if int(a[-1])>=1 and int(a[-1])<=5:
    print("YES")
else:
    print("NO")

# Published By PKJCODERS

 (Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.) 

Comments

Popular Posts

Snakes and Ladders

Sort integers in String

Flowchart Logic 065

Matrix Unit Digit Swap

Reverse Column - First and Last

Alphabetical Order Pattern

String With Most Vowels