write an algorithm to find the sum of first n natural number?
please help
Answers
Answered by
0
Answer:
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; Here in this Algorithm we declare 3 variables n for storing the number, i for running the for loop and sum for storing the sum. Read the number n.21-Mar-2021
Similar questions
English,
1 month ago
Political Science,
1 month ago
Chemistry,
3 months ago
English,
3 months ago
Math,
9 months ago