Question 1 (30%) Write your code in Q1() that first asks the user to enter a positive integer, then prints out messages
Posted: Fri Jul 01, 2022 5:33 am
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