Skip to content

Latest commit

 

History

History
29 lines (16 loc) · 583 Bytes

README.md

File metadata and controls

29 lines (16 loc) · 583 Bytes

PrimeSum

Read in a sequence of 32-bit signed integers (one per line) until zero. Add up the prime integers. Then output on a line the statement “The sum of the primes is x.” where x is the sum (also representable as a 32-bit integer). The input should be taken from keyboard/stdin/System.in.

Sample Input:

1

-2

6

13

0

The output should be sent to console/stdout/System.out.

Sample Output:

The sum of the primes is 13.

A test file is provided with sample inputs. To run the program, in the terminal input the following command:

python3 primesum.py < A1_primesum.in