Computer Science, asked by Anghrijaghosh, 3 days ago

wap to enter a no. and see if it's divisible by 3 and 5 or not​

Answers

Answered by ashishpahariyamca202
0

Answer:

number =int(input("Enter a number : "))

if number%3==0 and number%5==0 :

print("{ } is divisible by 3 and 5".format(number))

else :

print("{ } is divisible not by 3 and 5".format(number))

Explanation:

#python 3

first we are taking a input from the user which is an integer

and by using if else statement we will check weather the number is divisible by 3 and 5 if it is divisible if statement will print it is divisible and if not, else statement will print

now comes to( if number%3==0 and number%3==0 )

in this we are checking if the given number is divisible by 3

And 5 by using modulus operator

modulus gives remainder of the division of left operand by the right if number is completely divisible by 3 and 5 it will given no remainder that is why we are using == to check whether the remainder is 0 or not

and Between we are using logical And operator

and True if both the operands are true

for example x and y

if x and y are both true

then it is true

hope this solution will help you because it a basic program

Similar questions