Computer Science, asked by AkshayaG2010, 1 day ago

Write a program in python to calculate 10% discount on the total purchase of stationary

Answers

Answered by rishita29gupta
2

Answer:

n=int(input("Total number of items="))

sum=0

for i in range(1,n+1):

    c=int(input())

    print("Cost of item",i,"=",c)

    sum=sum + c

print("Total cost=",sum)

a=sum+(sum*0.1)

print("10% Discount in total purchase =",a)

Explanation:

we have taken n for total number of items

Then we have to write the cost of each item so we have taken for loop

and c variable is for writing cost of item here for loop runs n times which is the number of items

Then, we have taken initial value of sum variable=0 so that each cost get added when for loop runs and print final value of sum outside for loop

For discount:

Suppose we have to take 10% discount on 100

=100+(10% of 100)

=100+(0.1 * 100)                                10%= 10/100=0.1

now replace value of 100 from sum as in above program

Similar questions