1 solutions
-
0
C :
#include<stdio.h> int main() { int i,sum; char s[202]; while(gets(s)) { sum=0; i=0; while(s[i]!='\0') { if(s[i]!=' ') sum+=s[i]-'0'; i++; } printf("%d\n",sum); } return 0; }C++ :
#include <iostream> using namespace std; int main() { int a,b; while(cin>>a>>b) { int c=0,d=0; while(a) { c+=(a%10); a=a/10; } while(b) { d+=(b%10); b=b/10; } cout<<c+d<<endl; } return 0; }
- 1
Information
- ID
- 16783
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By