Saturday, October 25, 2014

UVA-12403 (Save Setu)

UVA-12403 (Save Setu)

0001

#include<stdio.h>
int main()
{
char s[100];
int a,sum=0,n;
scanf("%d",&n);
while(0<n)
{
scanf("%s",s);
if(strcmp(s,"donate")==0)
{
scanf("%d",&a);
sum=sum+a;
}
else
{
printf("%d\n",sum);
}

n--;
}
return 0;


}


 


UVA-12403 (Save Setu) UVA link

No comments:

Post a Comment