Uva 10346 – Peter’s Smokes

Solution :-

#include<stdio.h>
int main()
{
int a,n,k;
while(scanf(“%d %d”,&n,&k)==2 && k>1)
{
a=n;
while(n>=k)
{
a=a+(n/k);
n=(n/k)+(n%k);
}
printf(“%dn”,a);
}
return 0;
}
At First you can try to solve this problem if you can’t than see this code & find what’s your problem . If you copy paste this code you could not improve yourself in programming .

Posted by Shipu Ahamed

Leave a Reply