Skip to content

Instantly share code, notes, and snippets.

@raryosu

raryosu/1_8_B.c Secret

Created July 5, 2015 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raryosu/38698ec3b391df49874a to your computer and use it in GitHub Desktop.
Save raryosu/38698ec3b391df49874a to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main()
{
char value[1001];
int sum=0,i=0;
while(1)
{
scanf("%s",value);
if(value[0]=='0')break;
while(value[i]!='\0')
{
sum+=(int)value[i]-'0';
i++;
}
printf("%d\n",sum);
sum=0;
i=0;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment