CodeSolved

Solved Programming Questions & Exercises

Calculate the discount

Practice Easy 114/ Download 3248 Views Most popular

We have a list of different items along with their discount percent and we want to know how much the final price of each product is after considering the discount.

Write a program that receives the product price and the percentage of discount and prints the final price and discount value at the output.

Program must continue until the user has not entered 0


gheymat mahsool: 10000000
Darsad Takhfif: 20

gheymat nahaei = 8000000
Takhfif = 2000000

15 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
f=0
a=0
while 1:
   i =int(input('geymat jens chande:'))
   a+=i
   takhfif=20
   darsad=100
   b=i*takhfif/darsad
   f+=b
   if i ==0:
    break
print(int(f),' darsade takhfife shoma')
print(int(a-f),' geymate nahayie jens')
Maryam.n Download Python
while 1:
     gheymat = int(input("gheymat ra vared konid: "))
     if gheymat == 0:
          break
     takhfif = int(input("takhfif ra vared konid: "))
     if takhfif > 100:
          print("error")
          break
     baghi_mande = 100 - takhfif
     gheymat_nahayi = baghi_mande/100*gheymat
     print("=====================================")
     print("-----------------{}---------------".format(gheymat_nahayi))
     print("=====================================")
Shayan.fm Download Python
while True:
    a=int(input("ghemat: "))
    b=int(input("takhfif: "))
    c=b/100
    d=(a*c)
    print("mablagh ghabel pardakht"+str(a-d))
    print("mablagh kasr shode="+str(a-(a-d)))
    e=input("baray payan adad sefr ra vared konid: ")
    if e=="0":
        break
User 299 Download Python
while 1:
    gheymate_mahsoul = float(input("lotfan gheymate mahsoul ra vared konoid(toman): "))
    darsad_takhfif = float(input("lotfan darsade takhfif ra vared konoid:  % "))
    takhfif = gheymate_mahsoul * (darsad_takhfif / 100)
    gheymate_nahaee = gheymate_mahsoul - takhfif
    if gheymate_mahsoul == 0:
        break
    print("gheymate mahsoul = ", gheymate_mahsoul, "toman \n", "darsade takhfif = ", darsad_takhfif,"%")
    print("gheymate nahaee = ", gheymate_nahaee, "toman" , "\n", "takhfif = ", takhfif, "toman")
while True:
    a=float(input("Please enter the original price of the product:\n"))
    if a==0:
        break
    else:
        b=float(input("Please enter the product discount percentage:\n"))
        print(f"Product discount amount: {(a*b)/100}\nThe final amount of the product: {a-((a*b)/100)}")
        continue
Zaras Download Python
while 1 :
    price=float(input('price($) : '))
    discount =float(input('discount(%) : '))
    new_price=price - (price/100 *discount)
    if discount  in range(-1,101):
        print(new_price,'$')
    else :
        print('erorr')
Blueraven Download Python
def D(a, b):
    return a - b
def C(u, g):
    w = u / 100 
    return w * g   
while True:
    t = float(input("gheymat :"))
    if t == 0:
        break
    v = float(input('darsad takhfif : '))
    if t == 0:
        break
    k = C(t, v)
    print("-------------------------------")
    print('gheimat akhar :',D(t, k))
    print('takhfif : ', k)
    print("-------------------------------")
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

×
×
Close