“Konversi kode Python ke PHP” Kode Jawaban

Konversi kode Python ke PHP

def no_of_notes(amt, note):
    n = [0, 0, 0]
    min_amt = 0
    for i in note:
        min_amt += i

    if amt < min_amt:
        i = 0
        while amt != 0:
            n1 = amt // note[i]
            amt = amt - (n1 * note[i])
            n[i] += n1
            i += 1
    else:
        n = [1, 1, 1]
        if amt == min_amt:
            return n
        i = 0
        amt -= min_amt
        while amt != 0:
            n1 = amt // note[i]
            amt = amt - (n1 * note[i])
            n[i] += n1
            i += 1
    return n


Amount = int(input('Enter a price: '))
note = [500, 200, 100]
result = no_of_notes(Amount, note)
number_of_notes = 0

for i in range(len(note)):
    if result[i] != 0:
        print(f' Rs.{note[i]} notes = {result[i]}')
    number_of_notes += result[i]

print(f'Total number of notes = {number_of_notes}')
Sathish Suresh

Konversi kode Python ke PHP

def no_of_notes(amt, note):
    n = [0, 0, 0]
    min_amt = 0
    for i in note:
        min_amt += i

    if amt < min_amt:
        i = 0
        while amt != 0:
            n1 = amt // note[i]
            amt = amt - (n1 * note[i])
            n[i] += n1
            i += 1
    else:
        n = [1, 1, 1]
        if amt == min_amt:
            return n
        i = 0
        amt -= min_amt
        while amt != 0:
            n1 = amt // note[i]
            amt = amt - (n1 * note[i])
            n[i] += n1
            i += 1
    return n


Amount = int(input('Enter a price: '))
note = [500, 200, 100]
result = no_of_notes(Amount, note)
number_of_notes = 0

for i in range(len(note)):
    if result[i] != 0:
        print(f' Rs.{note[i]} notes = {result[i]}')
    number_of_notes += result[i]

print(f'Total number of notes = {number_of_notes}')
Sathish Suresh

Jawaban yang mirip dengan “Konversi kode Python ke PHP”

Pertanyaan yang mirip dengan “Konversi kode Python ke PHP”

Lebih banyak jawaban terkait untuk “Konversi kode Python ke PHP” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya