#include int main() { int ks = 100, item =5; int iweight[5] ={3,5,4,2,1}; int uprice[5] ={20,15,7,10,25}; for(int i = 0; i uprice[j]) { int temp = uprice[i]; uprice[i] = uprice[j]; uprice[j] = temp; temp = iweight[i]; iweight[i] = iweight[j]; iweight[j] = temp; } } } int cnt = 0, profit = 0; while(ks != 0 && cnt < item) { if(ks > iweight[cnt]) { profit += iweight[cnt] * uprice[cnt]; ks -= iweight[cnt]; printf("Item %d taken\n eto Kg: %d\n",cnt,iweight[cnt]); } else { profit += ks * uprice[cnt]; printf("Item %d taken\neto Kg: %d\n",cnt,ks); ks = 0; } cnt++; } printf("Profit is %d\n",profit); // for(int i = 0 ; i