76 255
Assignments Done
98,5%
Successfully Done
In May 2019

# Answer to Question #1572 in C++ for Zkursh

Question #1572
The program will ask for a number. Then will display the odd numbers on that number. Then on the next line will show the even numbers from the number we have input.

Then add up all even numbers... and then multiply all the odd numbers
Expert's answer
``#include <cmath>#include <iostream>using namespace std;int main(int argc, _TCHAR* argv[]){    int evendata;    int odddata;    int a, b, c;    int multiplyodd=1;    int sumeven=0;    b=0;    c=0;    do      {          cout << "Please enter a positive integer (negative integer to stop):"<< ' ';          cin>> a;          if (a>0){          if (a%2 == 0 )          {              c++;              evendata[c]=a;          }          else{              b++;              odddata[b]=a;          }          }      }      while (a>=0);      cout << "You have entered" << ' '<< b << ' ' <<"odd numbers: " ;       for(int i=1;i<=b;i++){           multiplyodd*=odddata[i];          cout<<<"  ";      }      cout << endl<< "And" << ' ' << c << ' ' <<"even numbers: ";       for(int i=1;i<=c;i++){          sumeven+=evendata[i];          cout<<<"  ";      }      cout<<<"The sum of even numbers is "<<<<"The multiply  of odd numbers is "<<< endl<< "Press any key to exit";      getch();    return 0; } ``

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

#### Comments

No comments. Be first!

Submit