Question 1 (30%) Write your code in Q1() that first asks the user to enter a positive integer, then prints out messages

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Question 1 (30%) Write your code in Q1() that first asks the user to enter a positive integer, then prints out messages

Post by answerhappygod »

Question 1 30 Write Your Code In Q1 That First Asks The User To Enter A Positive Integer Then Prints Out Messages 1
Question 1 30 Write Your Code In Q1 That First Asks The User To Enter A Positive Integer Then Prints Out Messages 1 (204.17 KiB) Viewed 43 times
Please help and make sure that there is no error (syntax, logicand runtime errors are not allowed!), and please don't reply mewith irrelevant information or message. I just need your answer!Thanks. (Please test all the cases with a C++ programme, and theinstructions are clear)
Question 1 (30%) Write your code in Q1() that first asks the user to enter a positive integer, then prints out messages depending on the digits of the integer. The messages should be printed in the following correct order. ● Number of digits in the integer. Odd Version (6th digit of your student ID is 1, 3, 5, 7 or 9) Sum of all odd position digits of the integer. Note that the unit digit is the first position, the tenth digit is the second position and so on. For example, if the input is 123456, then the sum is 6+4+2=12. Some of the testing scenarios are given below for your reference. You should test your code using these and other important test cases to ensure it follows the specified requirements above. Odd Version (odd 6th digit in student ID) Even Version (even 6th digit in student ID) Even Version (6th digit of your student ID is 0, 2, 4, 6 or 8) Sum of all even position digits of the integer. Note that the unit digit is the first position, the tenth digit is the second position and so on. For example, if the input is 123456, then the sum is 5+3+1=9. Sample display Input: 123456 6 12 Sample display Input: 13579 5 15 Sample display Input: 38 2 8 Sample display Input: 0 1 0 Sample display Input: 123456 6 9 Sample display Input: 13579 5 10 Sample display Input: 38 2 3 Sample display Input: 0 1 0
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply