Advertisement
NabilaShova

12403-Save Setu

Apr 26th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main ()
  5. {
  6.     int t,s=0,d=0;
  7.     char a [100];
  8.     scanf ("%d", &t);
  9.     while ( t--)
  10.      {
  11.         scanf ("%s", a);
  12.         if (strcmp (a, "donate")==0)
  13.         {
  14.             scanf ("%d", &d);
  15.             s += d;
  16.         }
  17.         else
  18.         printf ("%d\n", s);
  19.     }
  20.  
  21.     return 0;
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement