Due to growing Traffic Problem Kejriwal wants to devise a new scheme. The scheme is as follows, each car will be allowed to run on Sunday if the sum of digits which are even is divisible by 4 or sum of digits which are odd in that number is divisible by 3. However to check every car for the above criteria can’t be done by the Delhi Police. You need to help Delhi Police by finding out if a car numbered N will be allowed to run on Sunday?
here is my code:
#include
using namespace std;
int main()
{
int n,r;
cin>>n;
for(int i=1;i<=n;i++)
{
int sum=0;
cin>>r;
while(r!=0)
{
sum=sum+r%10;
r=r/10;
}
if((sum%4==0) || (sum%3==0))
cout<<“Yes”<<endl;
else
cout<<“No”<<endl;
}
return 0;
}