koman 36 Newbie Poster

Ok so the code makes the user type in a number. Ok if the number is odd it must say "Invalid Input". If the number is EVEN it takes the ODD numbers of it and gives you the pairs that add up to the EVEN number.

For example if I type 8

I want

8 = 1 + 7

8 = 3 + 5

how do I extract the digits?

#include <iostream>
using namespace std;

int main()

{
   int q;
   int sum = 0;
   int num;

   cout << " Please enter a positive even interger ";
   cin >> num;

   if ( num % 2 != 0 )

      cout << "Invalid Input" << endl;

   else if ( num % 2 == 0 )


   {   for ( int i = 1; i <= num; i++ )  {


        if ( i % 2 != 0 )

           ( i = q , u );


      }


      if ( q + u  == num )

         cout << q << " + " << u << num <<  endl;

   }

   return 0;


}
Ancient Dragon commented: Thanks for using code tags correctly :) +36