Help me out | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

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

13th Jul 2022, 11:03 AM
Adeleke Abdul Rahmon
11 Answers
+ 5
input() is a builtin function. It's bad practice and can cause the program to fail is you use the predefined names
13th Jul 2022, 11:11 AM
Slick
Slick - avatar
+ 4
And try to understand the task: The task is not to print 20% of 50, but always 20% of the input, which isnt always 50. 50 is just the example
13th Jul 2022, 12:09 PM
Janne
Janne - avatar
+ 2
Help us help you. Post your code
13th Jul 2022, 11:06 AM
Slick
Slick - avatar
+ 2
import java.util.Scanner; public class Program { public static void main(String[] args) { //your code goes here Scanner sc=new Scanner(System.in); double bill=sc.nextDouble(); System.out.println(bill*15/100); } }
28th Feb 2023, 3:14 AM
Sk Rizvan
Sk Rizvan - avatar
+ 1
This is my attempt bill = int(input()) #your code goes here input =50 print("bill"*20/100)
13th Jul 2022, 11:08 AM
Adeleke Abdul Rahmon
+ 1
Ok thanks
13th Jul 2022, 12:09 PM
Adeleke Abdul Rahmon
0
bill = int(input()) #your code goes here input =50 print(50*20/100) I didn't get it
13th Jul 2022, 11:22 AM
Adeleke Abdul Rahmon
0
Ok
13th Jul 2022, 11:24 AM
Adeleke Abdul Rahmon
0
x = int(input()) print(x * 1.2 - x) Learn a bit more of Python, your tries were not even close
13th Jul 2022, 12:08 PM
Janne
Janne - avatar
0
import java.util.Scanner; public class Program { public static void main(String[] args) { // Check Object to create case sensitive object Scanner sc = new Scanner(System.in); double bill = sc.nextDouble(); System.out.println(bill*15/100); } }
28th Jan 2024, 3:34 PM
Anurag Pund
Anurag Pund - avatar
- 1
bill = int(input()) #your code goes here input =20 print(20/100*50)
13th Jul 2022, 11:16 AM
Adeleke Abdul Rahmon