Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- long long n,k,q=0,m=0;
- string str="";
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(false); cout.tie(false);
- cin>>n>>k;
- m=n*k;
- str=to_string(m);
- while(str.length()>1){
- for(int i=0;i<str.length();i++){
- q+=str[i]-'0';
- }
- //cout<<q<<endl;
- str=to_string(q);
- q=0;
- }
- cout<<str;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement