11.Write a Python to find the sum of all even and Odd number from n Number.
Solution :-
Static :-
i = 1 j = 1 sum = 0 sum1 = 0 n = 10
while i<=n: if i % 2 == 0: sum = sum + i elif i %2!=0: sum1 = sum1 +i i= i + 1 print(“The Sum of all Even number is :- “,sum) print(“The Sum of all Even number is :- “,sum1)
Output :-
Dynamic :-
i = 1 j = 1 sum = 0 sum1 = 0 n = int(input(“Enter the End value :- “))
while i<=n: if i % 2 == 0: sum = sum + i elif i %2!=0: sum1 = sum1 +i i= i + 1 print(“The Sum of all Even number is :- “,sum) print(“The Sum of all Even number is :- “,sum1)