Computer Science, asked by YAMUNAM, 2 months ago

4. A shop will give discount of 10% if the cost of purchased quantity is more than 1000.Ask user for quantity suppose, one unit will cost 100.Judge and print total cost for user.

Input: quantity

cost of a quantity =100

8

purchase_amount=8*100

if(purchase_amount>1000):

#provide 10% discount

Discount=purchase_amount*0.1

Total=purchase_amount-Discount

Print(“Total: “, Total)

else:

Total=purchase_amount

print(“Total: “,Total)





‼️‼️write a python program‼️‼️​

Answers

Answered by pragatibhatt2922
3

Answer:

Explanation:

Given:

A shop gives a discount of 10% if the cost of purchased quantity is more than 1000.

To find:

Print the total cost for user

Solution:

C program:

#include<stdio.h>

int main(){

int quantity;

float totalcost;

Printf(“enter quantity”);

Scanf(“%d”,&quantity);

If(quantity*100>1000)  

{

totalcost= ((quantity*100)-((10*(quantity*100)/100))  

//SUBTRACTING DISCOUNT FROM ORIGINAL AMOUNT

}

else

{

totalcost=quantity*100;  

//CALUCLATING TOTAL COST 100 PER UNIT

}

printf(“the total cost is %f”,totalcost);

return 0;

}

OUTPUT:

Enter quantity 20

The total cost is 1800

Explanation:

QUANTITY=20

SO 20100=2000

AS 2000 IS GREATER THAN 1000 WE GIVE 10% DISCOUNT  

SO  

10% IN 2000 IS  

SO 10% IN 2000 IS 200

WE CALUCLATE TOTALCOST BY SUBTRACTING

ACCTUAL COST-DISCOUNT COST

SO 2000-200=1800

1800 IS THE TOTALCOST

Answered by jai696
3

\huge\red{\mid{\fbox{\tt{Using\: Python\: 3}}\mid}}

def disc_calc(qty):

amount = qty * 100

return amount - (amount * .1) if amount > 1000 else amount

print("Total:", disc_calc((qty := int(input("qty: ")))))

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions
Math, 2 months ago