Q4: Write a program in python to calculate sum of first 10 natural numbers
Answers
Answer:
program to calculate sum of first n natural numbers in python
program to calculate sum of first n natural numbers in pythonoutput 1: enter the value of n: 6 sum of first 6 natural numbers is: 21.
program to calculate sum of first n natural numbers in pythonoutput 1: enter the value of n: 6 sum of first 6 natural numbers is: 21.output 3: enter the value of n: -10 enter a whole positive number!
program to calculate sum of first n natural numbers in pythonoutput 1: enter the value of n: 6 sum of first 6 natural numbers is: 21.output 3: enter the value of n: -10 enter a whole positive number!output 4: enter the value of n: 20 sum of first 20 natural numbers is: 210.
Answer:
(a) 36 - 2 + 8 x (19 - 17)
(b) 15 + 8 = 2 - (2 x 5)
(c) (5 * 5) - (6 = 2) - 5
(d) 19+ (3 - 15 + 5) * 3
(e) 70 - 12 x 3-5
Explanation:
(a) 36 - 2 + 8 x (19 - 17)
(b) 15 + 8 = 2 - (2 x 5)
(c) (5 * 5) - (6 = 2) - 5
(d) 19+ (3 - 15 + 5) * 3