ODD even back in delhi

Please guide me as i am having confusion like how should i assign num1 and num2 in main …also correct me in this code…it is not complete yet

include
using namespace std;

int calcnum1(int n){
int j1,num1=0, num2=0;

int N;
for (int i = 0; i < n; i++){
cin>>N;
while (N>0)
{
j1=N%10;
if (j1%2 == 0)
{
num1 += j1;

   }
   else if (j1 %2 != 0 )
   {
      num2 += j1;
   }
   
   N /= 10;
  }

}

return num1,num2;
}

int main(){
int n;
cin>>n;

return 0;
}

hi @abhinavssr2003_eab0717682969e5c,
do u know about strings?

i have little idea but haven’t reached there…

@abhinavssr2003_eab0717682969e5c, ok the implementation is wrong and also u cant simply return 2 values from function, u need custom class or pair you’ll be reading later these things

so i’ll give u a simple implementation with comments so that u can understand that using simple things

yeah i know…that’s why i was getting confused like it is not possible to return two values…so please help me to get it understandable…just tell me approach…i will convert it to code myself

@abhinavssr2003_eab0717682969e5c,
its nice u’ll try…

first make return type as bool which here make sense also for the question right?
then you need to check one more thing after getting the sum if even sum is div by 4 or odd sum is divisible by 3 if any of this is you can return true else false to the main function, also u r missing function call in main

okay I will try once more

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.