Week10_exercise
Week10_exercise
3. Check if an input number is a nearly prime number, which means the product
of two prime numbers.
6. Accept 2 integers n and s, n states for the number of digits available (chosen
from 0 to 9), s states for the target sum that needs to be achieved. The
program should print all unique combinations of the n digits (without
repetition) where the sum of the selected digits equals the given target s. The
program should not use any digit more than once in a combination. The
output should include all such unique combinations where the sum of the
digits equals s.
7. Reads sentences containing positive integers embedded in them and
calculates the sum of all the numbers. The program should be able to
process multiple lines of input, where each line may contain digits, letters,
symbols, or spaces. The program must extract all the digits (positive integers)
from the sentences and compute their total sum. Note that the digits in the
sentence are consecutive and do not have any separators, so the program
should correctly identify and sum up the numbers.