Write a program to input the to total amount in a bill & if the amount is greater than 1000, the discount of 8% is green, otherwise no discount is given output the total anwent, discount and final amount.
Answers
Answered by
2
Answer:
import java.util.*;
public class xyz{
public static void main{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the amount of the bill");
int a=sc.nextInt();
if(a<1000){
System.out.println("You got a dicount of 8%");
int b=(8*a)/100;
System.out.println("Your final bill = "+b);
}
else
System.out.println("You did not get any discount");
}
}
Explanation:
HOPE IT HELPS :-)
Answered by
3
def calculate_discount(amt):
if amt < 1000:
return f"Final amt: {amt}"
discount = amt * .08
return f"Total Amt: {amt}\nDiscount: {discount}\nFinal Amt: {amt - discount}"
print(calculate_discount((amt := float(input("amt: ")))))
Similar questions