New course! Every coder should learn Generative AI!
0

# Operator issue

When you go out to eat, you always tip 20% of the bill amount. But who’s got the time to calculate the right tip amount every time? Not you that’s for sure! You’re making a program to calculate tips and save some time. Your program needs to take the bill amount as input and output the tip as a float. Sample Input 50 Sample Output 10.0 Name= int(input()) That’s the program any idea how to solve?

11th May 2021, 1:07 PM
Sara_889
+ 2
Hey, pls show your attempt here that we can help... Happy Coding..
11th May 2021, 1:09 PM
Sâñtôsh
+ 2
Sara_889 Bill=int(input("enter your bill amount")) Tip=Bill*20/100 print (float (Tip))😍
11th May 2021, 1:15 PM
Sâñtôsh
+ 2
Sara_889 I can't understand your code Answer is zero correct due to you use modulus Operator That's use as 9%5 will give 4 12%2 will give 0
11th May 2021, 1:17 PM
Sâñtôsh
+ 1
Thanks you just solved my isue i still begginer and facing some obstacles 🙏
11th May 2021, 1:19 PM
Sara_889
+ 1
Sara_889 your welcome Keep learning 👌😍 If any problem occurred during learning or coding just message me, I'll help as possible..
11th May 2021, 1:21 PM
Sâñtôsh
0
Explanation: 20% of 50 is 10. To calculate 20% of a given amount, you can multiply the number by 20 and divide it by 100: 50*20/100 = 10.0 This is the question?
11th May 2021, 1:08 PM
Sara_889
0
bil= int(input()) x= 100 x *= 10 x %=50 Print(x)
11th May 2021, 1:11 PM
Sara_889
0
bill = int(input()) #your code goes here x= 100 x *= 100 x %=10 print(x) Still my output zero
11th May 2021, 1:15 PM
Sara_889
0
Here's the code: print(int(input())/5) # Hope this helps
11th May 2021, 2:46 PM
Calvin Thomas
0
bill = int(input()) print(float((bill / 100) * 20))
16th Dec 2022, 8:16 PM
Артур Николаев