Computer Science, asked by bharatipatil698, 7 months ago

There is a JAR full of Candies for sale at a mall
counter. JAR has the capacity N, that is JAR can
contain maximum N Candies when JAR is full
At any point of time, JAR can have M number of
Candies where M<-N. Candies are served to the
customers. JAR is never remaining empty as when
last k candies are left. JAR is refilled with new Candies
in such a way that JAR gets full.
Write the code to implement above scenario. Display
JAR at Counter with available number of candies.
Input should be number of candies one customer
orders at point of time. Update the JAR after every
purchase and display JAR at Counter.
Output should give number of Candies sold and
updated number of Candies in JAR
If input is more than number of Candies in JAR,
return: "INVALID INPUT"
Given,
N= 10.where N is NUMBER OF CANDIES AVAILABLE
k=<5, where kis number of minimum Candies that
must be inside JAR ever.
Example 1: (N=10, k=<5)
Input Value
3
Output Values
NUMBER OF CANDIES SOLD: 3
NUMBER OF CANDIES AVAILABLE: 7​

Answers

Answered by sunilgiri81
0

Answer:

gkjghttesdfkhdsadFS BYE BYE BYE BHYE BYE BYE BYE BYE.....................................................................................................................................

Explanation:

Answered by officialrupeshk
0

Answer:

i = int(input())

n = 10

k = 5

if(i >n):

print("INVALID INPUT")

print("NUMBER OF CANDIES AVAILABLE:", end="")

print(n)

elif(i <= 0):

print("INVALID INPUT")

print("NUMBER OF CANDIES AVAILABLE:", end="")

print(n)

else:

print("NUMBER OF CANDIES SOLD:", end="")

print(i)

print("NUMBER OF CANDIES AVAILABLE:", end="")

print(n-i)

Similar questions