Thursday, October 10, 2013

ALGORITHM TO FIND SUM OF THE SERIES 1+3+5+7+….UPTO N TERMS


STEP 1.       I <-- 0, J<--1, Sum <-- 0, N <-- 0
STEP 2.       Read N
STEP 3.       While (I <= N-1)
        Begin
             Sum <-- Sum+ J
         J <-- J + 2
      I <-- I + 1
             End
STEP 4.       Print Sum

No comments:

Post a Comment