Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = input()
- prime_sum = 0
- non_prime_sum = 0
- while n != 'stop':
- n = int(n)
- if int(n) % 2 != 0:
- prime_sum += int(n)
- if n == 'stop':
- break
- elif int(n) % 2 == 0:
- non_prime_sum += int(n)
- if n == 'stop':
- break
- n = input()
- if n < 0:
- print(f'Number is negative.')
- print(f'Sum of all prime numbers is: {prime_sum}')
- print(f'Sum of all non prime numbers is: {non_prime_sum}')
Advertisement
Add Comment
Please, Sign In to add comment