Computer Science, asked by Bhaijan8035, 4 months ago

Write algorithm for sum of n natural number

Answers

Answered by YaseeN6423
1

Explanation:

Declare a variable n, i and sum as integer; Read number n ; for i upto n increment i by 1 and i=1 { sum=sum+i; } Print sum; ... Read the number n. We use for loop and increment the loop by 1 upto n. Then we add the numbers and store it in sum.

Similar questions