Computer Science, asked by jitendrakumarp913, 4 months ago

WAP to print the even numbers within 51.Display the numbers and their

sum. [5]

Q4) WAP to input a number and find how many factors it has.​

Answers

Answered by jai696
1

\huge\red{\mid{\fbox{\tt{Using\: Python\: 3}}\mid}}

# even numbers from 2 to 51

even_nums = [n for n in range(2, 50 + 1) if n % 2 == 0]

print('\n'.join(map(str, even_nums)), f"\nsum even_nums: {sum(even_nums)}")

# find factors of a num

num = int(input("enter a num: "))

factors = [n for n in range(1, num + 1) if num % n == 0]

print(f"factors: {len(factors)}")

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions