- 2
Tipe calculator
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
3 Answers
+ 1
Hi Sohail
Here is the math:
bill*1.2 - bill
E.g. 50*1.2 = 60
60 - 50 = 10 <- your tip
0
# one simple way would be:
bill = float ( input ( ) )
p = 20.0 #percentage
tip = bill * p / 100.0
print ( round ( tip, 1 ) ) # 1 decimal figure
0
You should have given your code to us to check where you were wrong.
But lemme explain you in detail:-
You have to input any number
Then print the 20% of it (as float).
Like:
Input-: 50
Output-: 10.0
It's a two/one-liner code to do, show us your code so that we can help you in debugging it.