A prime number is defined to be a number divisible by 1 and itself and nothing else. In this assignment, you are to write a program that will read all the numbers stored in a file "data.in", check if each of them is a prime number, then print all those which turn out to be prime numbers in an ascending order along with some statistics. All the output must be stored in a file named "findings". The statistics will include the total number of entries in the input file, the number of primes, the number of non-primes, and the percentage of prime numbers to the total. The numbers in the input file may be any number between 1 and 1000000 with no limitation on how many are in the file. However, you may assume the number of primes will be no more than 100 numbers.
Example:
if "data.in" has:
20
5
14
7
1
3
9
19
11
2
4
18
17
16
15
6
8
10
13
12
"findings" should have:
20 numbers were checked.
9 prime numbers were found and 11 non-prime numbers.
45% of the numbers are prime.
The prime numbers found are:
1
2
3
5
7
11
13
17
19