- 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
15 Respuestas
+ 5
input() is a builtin function. It's bad practice and can cause the program to fail is you use the predefined names
+ 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
+ 2
Help us help you. Post your code
+ 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);
}
}
+ 1
This is my attempt
bill = int(input())
#your code goes here
input =50
print("bill"*20/100)
+ 1
Ok thanks
0
bill = int(input())
#your code goes here
input =50
print(50*20/100)
I didn't get it
0
Ok
0
x = int(input())
print(x * 1.2 - x)
Learn a bit more of Python, your tries were not even close
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);
}
}
- 1
bill = int(input())
#your code goes here
input =20
print(20/100*50)