Advertisement
juanjo12x

UVA_12403_Save_Setu

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