SEHH2042 Assignment
Ouestion 3 (30%)
Write your code in 03() that displays a square pattern with a triangle inside, as shown below,
according to the input size, which determines the number of rows and columns in the pattern.
Copyright By PowCoder代写 加微信 powcoder
If the input integer is O, negative or an even number, then your program should print nothing.
Odd Version (odd 6” digit in student ID)
Even Version (even 6” digit in student ID)
Sample display
Sample display
More examples
Output (Odd Version)
Output (Even Version)
Note: There should be no blank line in the output. You should use repetition structure, with
appropriate nested-loop, and NOT
Question 2 (30%)
Write your code in Q2() that first asks the user to enter integers (assume the inputs are non-
zero), then calculates the average of some of them (see below) and displays the result in 2
decimal places. The program should stop accepting numbers from the user when the user enters
a multiple of 5.
If the 5t digit of your student ID is odd, then the program should calculate the average of all
positive odd numbers. You can assume the user always enters at least one positive odd number.
If the st digit of your student ID is even (O is considered even), then the program should
calculate the average of all positive even numbers. You can assume the user always enters at
least one positive even number.
This last number that the user types should also be considered to be included in the average.
Odd Version (odd 5′ digit in student ID)
Even Version (even 5′” digit in student ID)
Sample display
Average is 10.33
Sample display
Average is 8.67
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com