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 ti | Sololearn: Learn to code for FREE!

0

# 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 ti

Please any one can do it

10/25/2021 1:35:29 PM

Billa Chandu

+6

Jolen Mascarenhas , as i understand, the code has to be in python? Billa Chandu , no, we will not do it for you! to get useful help from the community,  we need to see your attempt first. without having seen your code, it is difficult to find out where the issue is. => please put your code in playground and link it here thanks!

+2

#include <stdio.h> int main() { int amt; float ans; printf("enter the total amount\n"); scanf("%d", &amt); ans=0.2*amt; printf("You have to tip %f",ans); return 0; }

+1

Billa Chandu I will give u a tip. tip = 20% of bill amount; give/pay tip.

0

Make amt as float n not int My bad🤦😅

0

Oh ...😅

0

I guess that's too simple 😝

0

I think first u should give it a try

0

Hmmm show me Ur program

0

Well at least try bro

0

I'll give u a start.... Declare 2 variables example a, b Take the total bill amount from the user n store it in a Find the percentage 0.2*a and store in b Print b That's it

0

0

Here is a simple function in python: https://code.sololearn.com/cByPTugd36u6/?ref=app

0

Using def () may confuse comprehension for Billa Chandu, because he must be a beginner

0

Yea, you might be right. But I assumed that he probably wanted to use it in some program, and I wanted to show how it would look in a function.

-1

What? That's not it bro Where did bacteria come from??,😒😒

-1

You should try it before because there is a lot of practice : bill = int(input()) amount = (bill*20/100) print(amount)

-3

-4

-4

Ok go on

-4

Ya but i couldn't find itt sooo