not passing test case! pls reply as soon as possible
Delhi odd even test
For each test case you have to start sumodd = 0 and sumeven=0 but you just initialised them once with zero and for next test case they are starting with the answers of precious test cases which is wrong !!!
Assign the value of sumeven and sumodd to zero at the end of each test cases.
Really Thanks Abishek👍!
Please help me also test case is not passing
#include
using namespace std;
int sumof(long long int n);
int main() {
int t;
cin>>t;
for(int i=0;i<t;i++){
long long int n;
cin>>n;
int sum=sumof(n);
if(sum%2==0){
if(sum%4==0){
cout<<“Yes”<<endl;
}
else{
cout<<“No”<<endl;
}
}
else{
if(sum%3==0){
cout<<“Yes”<<endl;
}
else{
cout<<“No”<<endl;
}
}
}
return 0;
}
int sumof(long long int n){
int sum=0,digit;
while(n>0){
digit=n%10;
sum=sum+digit;
n=n/10;
}
return sum;
}