Monday 10 December 2018

Algorithm for summation of n numbers


Summation of n numbers
Algorithm for summation of n numbers:
Step1 : Start
Step2 : Declare three variables n, S and I
Step3 : Read n from keyboard
Step4 : Initialize s to 0 and I to 1
Step5 : Add values  of S and I and store it in S
Step6 : Increment value of I by 1
Step7 : Repeat steps 5 and 6 until I <= n
Step8 : Print S
Step9 : Stop




No comments:

Post a Comment