def calculateDiscount(billAmount):
bill_amount=billAmount
sumOddDigits=0
sumEvenDigits =0
while(bill_amount>0):
digit=bill_amount%10
if(digit%2==0):
sumEvenDigits+=digit
else:
sumOddDigits+=digit
bill_amount=bill_amount/10
return sumOddDigits*sumEvenDigits
billAmount=0;
discount=0;
totalBill=0;
billAmount=int(input("Enter the bill amount: "));
discount=calculateDiscount(billAmount);
totalBill=discount+billAmount;
print("Discount is:",discount);
print("The total bill is:",totalBill);
Comments
Leave a comment