Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- prime = 0
- nonPrime = 0
- num = input()
- while num != 'stop':
- number = int(num)
- if number >= 0:
- if number % 2 == 0 or number % 3 == 0 or number % 5 == 0:
- if number == 2 or number == 3 or number == 5 or number == 7:
- prime += number
- else:
- nonPrime += number
- else:
- prime += number
- else:
- print('Number is negative.')
- num = input()
- print(f'Sum of all prime numbers is: {prime}')
- print(f'Sum of all non prime numbers is: {nonPrime}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement