تمرین برنامه نویسی؛ با کدبزن!

منبع جامع سوالات و تمرینات برنامه نویسی

3
+1
+1
+1

محاسبه تخفیف

Hossein آسان 114/ دانلود 1205 بازدید

لیستی از اجناس مختلف به همراه درصد تخفیف آنها داریم و میخواهیم بدانیم قیمت نهایی هر محصول بعد از لحاظ کردن تخفیف چقدر میشود.

برنامه ای بنویسید که همانند زیر قیمت محصول و درصد تخفیف آن را دریافت کند و قیمت نهایی و مقدار تخفیف را در خروجی چاپ کند.

تا وقتی کاربر عدد 0 وارد نکرده است برنامه باید ادامه یابد


gheymat mahsool: 10000000
darsad takhfif: 20

gheymat nahaei = 8000000
takhfif = 2000000

19 جواب

نمیتونم این تمرین رو حل کنم!
2
+1
+1
while True:
    price = float(input("gheymat mahsool vared konid (0 to exit): "))
    if price == 0:
        break
    discount_percent = float(input("darsad takhfif vared konid: "))
    
    # Calculate the discount amount and final price
    discount_amount = price * discount_percent / 100
    final_price = price - discount_amount
    
    # Print the results
    print("mizane takhfif: ", discount_amount)
    print("gheymate nahaei: ", final_price)
Masterman دانلود Python
2
+1
+1
while True:

    qeymat = float(input('enter qeymat :'))
    if qeymat == 0:
        break
    takhfif = float(input('enter takhfif :'))

    f = float(qeymat * takhfif /100)
    b = float(qeymat - f)
    print(f'takhfif shoma az in kharid {f}\n aknon qeymat kala {b} ast')
کاربر 1224 دانلود Python
0
while True:
    geymat= int(input("geymat: "))
    if geymat==0:
        break
    else :
        takhfif= int(input("takhfif:  "))
        nime = (geymat*takhfif)/100
        nahayi = geymat - nime
        print("geymate nahayi shoma {} ast".format(nahayi))



Armintgco دانلود Python
0
while True:
	gheymat=float(input(' enter gheymat: '))
	if gheymat==0:
		break
	else:
		takhfif=float(input(' enter darsade takhfif: '))
	darsad_takhfif=(gheymat*takhfif)/100
	gheymat_nahaei=gheymat-darsad_takhfif
	print('gheymat_nahaei:',gheymat_nahaei)
	print('takhfif:',darsad_takhfif)
Abtin67 دانلود Python
0
while 1:
    price=int(input('price: '))
    if price==0:
        break
    else:
        discount=int(input('discount: '))
  print('final price:',price-(price*discount/100),'discount:',price*discount/100)
Ordinaryperson دانلود Python
0
while True:
    x = int(input('geymat: '))
    if x == 0:
        break
    h = int(input('takhfif: '))
    print((x*h)/100)
    print('----------------------')
Amirtaha دانلود Python
0
while True:
    a = int(input("gheymat mahsol: "))
    b = int(input("darsad takhfif: "))
    c = ((a * b) / 100)
    n = a - c
    print(f"gheymat nahaei:{n}")
    print(f"takhfif:{c}")
    if a == 0:
        break
کاربر 705 دانلود Python
0
while True:
     a = int(input(" the price:"))
    if a = 0:
         break
     b =float(input(" the off value:"))
     c = a * b
     d = a - c
     print(d)
Negar دانلود Python
0
try:
 print("For stop program type <0>")
 while True:

  Price_Mode = int( input( "Price_Mode :" ) )

  if Price_Mode == 0:
   break
  else:
   
   discoun_percent = int( input( "discount percent :") )
       
   All_discoun_percent = ( Price_Mode * discoun_percent ) / 100
  
   print("mizan takhfif :",All_discoun_percent )
  
   All_Price_Mode = ( Price_Mode - All_discoun_percent )
  
   print("ghymat nahai :",All_Price_Mode )

except:
 print("Error,you can more try")
کاربر 775 دانلود Python
0
while True:

 price = float(input("Enter mineral price:"))
 discount = float(input("Enter discount_price of mineral:"))

 txt = input("1.discounted 2.final_price 3.exit\n")

 if txt == "1":
    All_1 = ( price * discount ) / ( 100 )
    print( "discount is" , All_1 ) ;
    txt = input("Do you want to continuation(y|N)\n")
    if txt == "y":
        txt = input("1.discounted 2.final_price 3.exit\n")
        print( "final_price is",price - All_1 )
        txt = input("Do you want to continuation(y|N)\n")
        if txt == "y":
            txt = input("1.discounted 2.final_price 3.exit\n")
        else:
           if txt == "3":
            print("Good bye:)")
            break
کاربر 775 دانلود Python
0
gheymat = int ( input ( "First Gheymat : "))
Takhfif = int ( input ( "Takhfif : " ) )

print ( "You paid {} and don't pay {}" . format ( gheymat - (gheymat * ( Takhfif / 100 ) ) , gheymat * ( Takhfif / 100 ) ) )
Kian1390 دانلود Python
0
num = int(input('num: '))
ta = int(input())
print(num-(num * ta / 100))
print(num * ta / 100)
Amirhosein دانلود Python
0
while True:
    product_price = float(input("Enter price of the product(to exit print(0) ) : "))
    if product_price == 0:
        break
    
    product_discount = float(input("Enter discount of product : "))
     
    discount_amont = product_price * product_discount/100
    final_price = product_price-discount_amont
    print (".............................................")
    print ("product_price :" , product_price)
    print ("product_discount :" , product_discount)
    print (".............................................")
    print ("discount_amont :" , discount_amont )
    print ("final_price : " , final_price)
    print ("...............................................")
Drake2024 دانلود Python
0
a=float(input("gheymat:"))
b=float(input("darsad takhfif:"))
print("gheymat nahaii=" , a-(a*(b/100)))
print("takhfif=" , a*(b/100))
Mm000 دانلود Python
0
while True:
    a=int(input("gheimate kala...>"))
    b=float(input("darsade takhfif...>"))
    c=a*b
    d=a-c
    print(d)
    if a==0:
        break
Mary12 دانلود Python
0
while True:
    mahsol = input('1.poshak :  ')
    if mahsol == '1':
        price =int (input("price : "))
        off =int (input("off : "))
        print(price * off / 100)


    if mahsol=='0':
        break
print (mahsol)        
Farshad10 دانلود Python
0
while True:
    
    a=float(input("ghimat mahsool:"))
    if a==0:
        break
    b=float(input("drsad takhfif:"))
    c=a*b/100
    d=a-c
    print("ghimat nahai mahssol:",int(d))
    print("takhfif:",int(c))
کاربر 1991 دانلود Python
0
while True :
    price=float(input('price : '))
    if price==0:
        break
    disc= float(input('discount : '))
    
    print('price with discount : {}'.format(price*(1-(disc/100))))
Soheyl دانلود Python
0
while True:
  ghei=int(input('gheimat:'))
  if ghei==0 :break
  takhfif=int(input("takhfif:"))
  if takhfif==0 :break
  d=int(takhfif*ghei/100)
  o=ghei-d
  print(o)   
Amirrafei76 دانلود Python

ارسال جواب

# کداتو توی این بخش بنویس
# فرقی نمیکنه چه زبان برنامه نویسی باشه، همرو پشتیبانی میکنیم :)
# البته قبلش این سه خط رو پاک کن


  • تو جوابت میتونی از تصویر، کد، لینک به سایر صفحات و... استفاده کنی
  • لطفا جواب های تکراری ارسال نکن
  • جواب های ارسالی، پس از بررسی کوتاهی، ویرایش میشن و در سایت نمایش داده میشن
  • ارسال جواب حق مادی یا معنوی برای ارسال کننده ایجاد نمیکند و تمام حقوق برای سایت کدبزن محفوظ است

تمرینات مرتبط

تشخیص با استفاده از هوش مصنوعی
×
×
بستن