How we do a code for percent?? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How we do a code for percent??

Who can help me out 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

1st Sep 2022, 3:35 PM
aissa mesrouk
aissa mesrouk - avatar
2 Antworten
0
if you mean what is the percent of x compared to y then its x/y*100
1st Sep 2022, 3:44 PM
dan
dan - avatar
0
clear what you mean now 20% of a number is just (number * 20 / 100)
1st Sep 2022, 6:48 PM
dan
dan - avatar