Computer Science, asked by siddhibhavyaa5640, 1 year ago

Algorithm for finding sum of first ten natural numbers

Answers

Answered by omkar81
21
· To find the sum of first 50 natural numbers. Step 1: start Step 2:sum = 0 ,N= 0 Step 3: N =N+1 Step 4:sum = sum + N step 5:if SUM<50 then go to step 3 Step 6:DISPLAY sum Step 7: stop; 7.
Answered by AneesKakar
0

The algorithm to find the sum of the first ten natural numbers:

Step 1: Start

Step 2: Declare a variable 'n' and store the value 10 in it.

Step 3: Declare two variables sum to 0 and i to 1.

Step 4: Repeat steps 5 and 6 for i<=n that is 'i' is less than or equal to 10.

Step 5: Update the variable sum as sum = sum + i

Step 6: Increment 'i' that is increase the value of 'i' by 1.

Step 7: Print the final value of the variable 'sum'.

Step 8: Now stop and exit the given algorithm.

Output: The output would the sum of the first 10 natural numbers.

#SPJ3

For more similar questions click on the following links:

https://brainly.in/question/28029849

https://brainly.in/question/38396322

Similar questions