- 3
đ´Help plZđ´
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. Input =50
15 Antworten
+ 9
Just remove the line bill = 50 from your code
+ 1
* get input
* convert input to numeric data type
* multiply by 20/100
* output
Link your code please!1
+ 1
Why are you setting bill = 50? bill should be the user input!
0
bill = int(input())
y = 20/100
bill =50
print (bill * float(y))
Is it wrong ?
0
bill = int(input())
y = 20/100
bill =50
print(float(bill * (y)))
Or this ?
0
Thx i got it
bill = int(input())
y = 20/100
print(float(bill * (y)))
0
Yes right
0
Bill=float(input())
Print(.2*Bill)
0
use float
bill=float(bill)
- 1
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
- 1
50 is only an example â the user could input any other number
- 1
Thx lisa
- 1
So whatâs the exactly code ?
- 1
bill_amount = int(input())
tip = 0.2 * bill_amount
print(tip)
- 3
int main(){
int bill;
scanf("%d", &bill);
float tip = bill * 02;
printf("%.2f", tip);
}
Change that to python