**CSE 1311 – Homework #02 **

- You must submit your homework through Blackboard (https://elearn.uta.edu/).
- The answer file should be named using the following pattern:

X_Y_HW2.doc where X is your last name and Y is your first name.

- Your answer file should include:
- A copy of your code from program1.
- A copy of your code from program2.

- Make sure your code can be compiled with no error prior submission. Codes which cannot be compiled will get 0 points.

Assignment:

**Program 1- **(50) Write a program that prompts the user for an integer and then determines and prints if the integer is divisible by 3 and 4 or not.

- Assume that the number that the user enters is an integer.
- Sample Outputs:
- Enter an integer: (12)

12 is divisible by 3 and 4.

- Enter an integer: (32)

32 is Not divisible by 3 but divisible by 4.

- Enter an integer: (105)

105 is divisible by 3 but Not divisible by 4.

- Enter an integer: (121)

121 is Not divisible by 3 and Not divisible by 4.

**Program 2-** (50) Write a program that prompts the user for four integers and produces the average of positive integers.

- You can only use statements and conditionals; do not use loops or arrays.
- When displaying the average, round it off to two decimal places.
- If there are no positive integers, then you can’t produce an average. In this case inform the user that there were no positive integers.
- Sample Outputs:
- Enter an integer: (8)

Enter an integer: (-4)

Enter an integer: (15)

Enter an integer: (-6)

The average of the 2 positive integers is 11.50

- Enter an integer: (7)

Enter an integer: (12)

Enter an integer: (-10)

Enter an integer: (9)

The average of the 3 positive integers is 9.33

- Enter an integer: (-2)

Enter an integer: (-6)

Enter an integer: (-8)

Enter an integer: (-10)

There were no positive integers