diff --git a/FRACTIONAL_KNAPSACK_PROBLEM.py b/FRACTIONAL_KNAPSACK_PROBLEM.py new file mode 100644 index 0000000..0cb9104 --- /dev/null +++ b/FRACTIONAL_KNAPSACK_PROBLEM.py @@ -0,0 +1,29 @@ +n=int(input("enter the no of input")) +b=[] +w=[] +r=[] +s=int(input("enter the total weight")) +v=0 +for i in range (0,n): + a=int(input("enter the benefict")) + d=int(input("enter the weight")) + b.append(a) + w.append(d) + r.append(a/d) +for i in range (0,n): + for j in range(i,n): + if r[i]