Assignment #1 (1).pdf - COMP 1602 \u2013 Computing Programming II Assignment#1 Date Due Sunday February 2 2019 11:59 pm Description A set of students were

# Assignment #1 (1).pdf - COMP 1602 – Computing Programming...

This preview shows page 1 - 2 out of 2 pages.

COMP 1602 – Computing Programming II Assignment #1 Date Due: Sunday February 2, 2019 @ 11:59 pm 1 Description A set of students were polled to find out their favourite number between 1 and 100 (inclusive). The numbers are stored in a file, numbers.txt . The amount of students is not known beforehand but -1 terminates the data. Zero is stored in the file if a student does not wish to reveal his/her favourite number. a) Write a program which opens the file and reads all the numbers specified by the students. b) For each distinct number specified by the students, you must do the following if the number is valid (i.e., between 1 and 100): i) Determine if the number is perfect – a perfect number is a positive integer that is equal to the sum of its proper divisors (i.e., does not include the integer itself), e.g., 6. ii) Determine if the number is prime – a prime number is a number that is divisible only by itself and 1, e.g., 7. iii) Determine if the number is a perfect square – a number that can be expressed as the product of two equal integers, e.g., 25 which is the product of 5 and 5.