Skip to content

Instantly share code, notes, and snippets.

View sachinthange1's full-sized avatar

sachinthange1

View GitHub Profile
@sreedharmb
sreedharmb / maximum product
Created September 16, 2012 06:06
You are given an integer s and an integer k. Find k positive integers a1, a2, ..., ak such that their sum is equal to s and their product is the maximal possible.
int product(int s,int k)
{
int temp=0;
int i,max;
if(k==1)
return s;
else
{
for(i=1;i<s;i++)
{