Click Here to see the problem detail.

Solution

This is so much straight forward problem. So the source code is given below with out any explanation.

Source Code
#include<string.h>
 
int main()
{
    char str[10];
    long amount=0, x;
    int tc;
    scanf("%d",&tc);
    while(tc--)
    {
       scanf("%s",str);
       if(strcmp(str,"donate")==0)
        {
        scanf("%ld",&x);
        amount+=x;
        }
       else
         printf("%ld\n",amount);
    }
   return 0;
}

 


Next Previous