Tuesday 13 February 2024

Class 11 CS Practical - 21

 

21 - Write a program in Python to input a number and determine the multiplication of the digits of that number.

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

product=1

while n>0:

    r=n%10

    n=n//10

    product=product*r

print("Multiplication of digits=",product)


Output:

Enter a number: 145
Multiplication of digits= 20

Enter a number: 346
Multiplication of digits= 72

No comments:

Post a Comment