Codeforces 102B. Sum of Digits Solution
- Solution IN c++:
- ///**********ALLAH IS ALMIGHTY************///
- ///AH Tonmoy
- ///Department of CSE,23rd batch
- ///Islamic University,Bangladesh
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int sum = 0,i,c=0;
- string s;
- cin>>s;
- {
- c=0;
- while(s.length()>1)
- {
- sum=0;
- for(i=0; i<s.length(); i++)
- {
- sum=sum+(s[i]-'0');
- }
- s=to_string(sum);
- c++;
- }
- cout<<c<<endl;
- }
- }
what is this line mean---
ReplyDeleteto_string (sum) .. what the hell is this (to_string)