A have been solving a problem to find the sum of digits of number. Following is my code:
#include <iostream>
using namespace std;
int main(){
ios_base::sync_with_stdio(true);
cin.tie(NULL);
int T;
cin >> T;
while(T--){
int n;
cin >> n;
int sum = 0;
while(n > 0){
sum += n%10;
n/=10;
}
cout << sum << "\n";
}
return 0;
}
I am getting a SIGCONT error. Surprisingly people with same solution have successful submission for same code. Can anyone help me with this?