Question: Write a program in c++ that submits a value between 4-8 digits that follow the rules below. The value must be greater than 1000 and

Write a program in c++ that submits a value between 4-8 digits that follow the rules below.

The value must be greater than 1000 and less than 100,000,000 (to ensure that there are between four and eight digits and that the integer is positive).

The last digit in the number (in the 1s place) must be even. The second-to-last digit (in the 10s place) in the number must be odd. The third-to-last digit (in the 100s place) in the number must be even. The fourth-to-last digit (in the 1000s place) must be odd. This pattern should repeat until there are no more digits left.

The number representing the summation of the digits must be even.

two example integer codes that would be allowed are: 1234 and 21416. For 1234, the digits alternate in an even/odd pattern from the last digit (4 is even; 3 is odd; 2 is even; and 1 is odd) and the number representing the summation of the digits (1+2+3+4=10) is even. For 21416, the digits alternate in an even/odd pattern from the last digit (6 is even; 1 is odd; 4 is even; 1 is odd; 2 is even) and the number representing the summation of the digits (2+1+4+1+6=14) is even.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!