c++ sum of even and odd numbers

//given the fact that it takes n of number
void sumEvenAndOdd(){
int n=0 , evenSum=0 , oddSum=0;
     int numbers[Size];
     cout<<"enters the number(N) of integers\n";
     cin>>Size;

     cout<<"Enter "<<Size<<" number/s:\n";
     for(int i =0 ;i< Size ; ++i){
        cin>>numbers[i];
     }
     for(int i =0 ;i<Size ; ++i){
        if(numbers[i]%2 ==0){
            evenSum += numbers[i];
        }
        else{
            oddSum += numbers[i];
        }
     }
     cout<<"the sum of even numbers is : "<<evenSum <<"\nthe sum of odd numbers is :"<<oddSum<<endl;
}

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to calculate the sum of 10 odd numbers series in c++ sum of even num =and odd num in cpp find total number of odd and even numbers in array c++ c++ program to count odd and even numbers c++ program to find the sum of all odd numbers from 1 to N. Accept N. Display the sum even odd sum find with while loop c++ The sum of the two individual digits is an odd number c++ chegg sum of even number in c++ c++ program to find sum of even numbers using for loop how to add even odd in c++ c++ even sum code example even and odd numbers adding c++ code for even and odd numbers in c++ write a program to compute the sum of odd numbers between 1-10 in c++ print sum of even numbers in c++ program to sum only even numbers in c++ sum odd number c++ sum of odd numbers using class in c++ sum of even and odd numbers of given number in c++ sum of even and odd numbers in an integers in c++ sum of even and odd numbers in integers in c++ sum of odd numbers in array in c++ sum of odd numbers c++ Sum of even &amp; odd c++ even numbers summation c++ C++ program to count odd and even numbers in array sum of even and odd numbers from a to b in c++ without loop sum of even and odd numbers from a to b in c++ formula sum of even and odd numbers from 1 to n in c++ formula get sum of odd and even digits of number c++ c++ code for odd and even numbers how to count even and odd numbers in c++ How to find n odd numbers c++ odd sum and even sum c++ sum of range of odd numbers calculator print out 10 odd numbers c++ while loop c++ program to print odd numbers from 1 to 100 c++ sum of even and odd numbers
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source