Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int isDigitSumPalindrome(int N) {
- string str,st,st1;
- str=to_string(N);
- int sum=0;
- for(int i=0;i<str.size();i++)
- {
- int a=str[i]-'0';
- sum+=a;
- }
- st=to_string(sum);
- st1=st;
- reverse(st1.begin(),st1.end());
- if(st1==st) return 1;
- else return 0;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement