Uva 12403 – Save Setu

Problem:-http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=&problem=3834&mosmsg=Submission+received+with+ID+10582519

Solution :-

#include <stdio.h>
#include <string.h>

int main ()
{
    int t,s=0,d=0;
    char a [100];
    scanf (“%d”, &t);
    while ( t–)
     {
        scanf (“%s”, a);
        if (strcmp (a, “donate”)==0)
        {
            scanf (“%d”, &d);
            s += d;
        }
        else
        printf (“%dn”, s);
    }

    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