Uva 11877 – The Coco-Cola Store

Problem Link

Solution :-



#include<stdio.h>
int main(){
    int n;
    while(scanf(“%d”,&n)==1)
    {
    if(n==0)
    break;
    int c=0;
    while(n>=3)
    {
    n=n-3;
    c++;
    n=n+1;
    }
    if(n==2)
    {
    c++;
        printf(“%dn”,c);
    }
    else
        printf(“%dn”,c);
    }
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